phpphp-resque

PHP-Resque won't run perform()


I am using PHP-Resque and can't get the perform() method to work. Can anyone tell what I'm missing?

This is my setup:

I always get a JobId and Status of 1. eg:

JobId: 757335754aec172166e8679cc3bfef58
Status: 1

I always get a Redis log that its been inserted. eg:

[2 127.0.0.1:38912] "sadd" "resque:queues" "JESSE"
[2 127.0.0.1:38912] "rpush" "resque:queue:JESSE" "{\"class\":\"Dog\",\"args\":[[\"hey\"]],\"id\":\"757335754aec172166e8679cc3bfef58\"}"
[2 127.0.0.1:38912] "set" "resque:job:757335754aec172166e8679cc3bfef58:status" "{\"status\":1,\"updated\":1398269884,\"started\":1398269884}"
[2 127.0.0.1:38912] "exists" "resque:job:757335754aec172166e8679cc3bfef58:status"

Yet it doesn't seem to be running the perform() method at all:

class Dog {
    public function perform()
    {
        echo 'TEST TEST TEST TEST';

        fwrite('/tmp/resque-output.txt', 'This is running', w);
        fwrite(STDOUT, 'Start job! -> ');
        sleep(1);
        fwrite(STDOUT, 'Job ended!' . PHP_EOL);
    }
}

Solution

  • Pretty sure it's this:

    putenv("QUEUE=* php bin/resque"); 
    

    That should just be:

    putenv("QUEUE=*"); 
    

    The second part is the command to start resque, which you're doing differently. As it stands, it's looking for a queue * php bin/resque instead of all queues (*).