2

PHP-Resqueを使用していますが、 perform()メソッドが機能しません。誰が私が欠けているかを教えてもらえますか?

これは私のセットアップです:

  • 以下を実行している3つのターミナルを開いています:
  • $ php workers.php
  • $ redis-cli monitor
  • $ php create.php(仕事を作るため)

  • 労働者.php

    <?php
    
    putenv("VVERBOSE=1");
    putenv("LOGGING=1");
    putenv("QUEUE=* php bin/resque"); 
    require_once APPPATH . '../vendor/chrisboulton/php-resque/bin/resque';
    
  • create.php

    <?php
    
    $jobId = Resque::enqueue('JESSE', 'Dog', ['hey'], true);
    echo "JobId: $jobId\n";
    
    $status = new Resque_Job_Status($jobId);
    if ($status->isTracking()) {
        echo "\nStatus: " . $status->get();
    }
    

私は常に 1 の JobId と Status を取得します。例:

JobId: 757335754aec172166e8679cc3bfef58
Status: 1

挿入されたRedisログを常に取得します。例えば:

[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"

それでも、まったく perform() メソッドを実行していないようです:

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);
    }
}
4

1 に答える 1

4

かなり確かにこれです:

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

それはちょうどあるはずです:

putenv("QUEUE=*"); 

2 番目の部分は resque を開始するためのコマンドですが、これは別の方法で行っています。現状では、すべてのキューではなくキューを探してい* php bin/resqueます ( *)。

于 2014-04-23T16:31:46.670 に答える