From 42ddc722221e0688c7df7a0f88e9b55d04f1484b Mon Sep 17 00:00:00 2001 From: Felix Peters Date: Thu, 29 Oct 2015 18:29:38 +0100 Subject: [PATCH 1/2] Log errors on worker when job is failing --- src/Worker.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Worker.php b/src/Worker.php index b96c367..050150b 100644 --- a/src/Worker.php +++ b/src/Worker.php @@ -403,6 +403,7 @@ protected function failJob($job, Exception $exception) $queue ); + $this->logger->error($exception->getMessage()); $this->getResque()->getStatistic('failed')->incr(); $this->getStatistic('failed')->incr(); } From 9484710e3acca98078b46d6c7e8794c777c50eec Mon Sep 17 00:00:00 2001 From: Felix Peters Date: Thu, 29 Oct 2015 18:34:10 +0100 Subject: [PATCH 2/2] - Add prefix for worker and enque command - litte fix in the readme to make it more modern php style with ::class --- README.md | 2 +- src/Console/EnqueueCommand.php | 5 ++++- src/Console/WorkerCommand.php | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 67ba33a..2b3afb2 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ use Resque\Resque; use Predis\Client; $resque = new Resque(new Client()); -$resque->enqueue('default_queue', 'App\Job', array('foo' => 'bar'), true); +$resque->enqueue('default_queue', \App\Job::class, array('foo' => 'bar'), true); ``` In order the arguments are: queue, job class, job payload, whether to enable tracking. diff --git a/src/Console/EnqueueCommand.php b/src/Console/EnqueueCommand.php index 18a13d0..8c38cbb 100644 --- a/src/Console/EnqueueCommand.php +++ b/src/Console/EnqueueCommand.php @@ -17,7 +17,7 @@ protected function configure() parent::configure(); $this - ->setName('enqueue') + ->setName('queue:enqueue') ->setDescription('Enqueues a job into a queue') ->addArgument( 'queue', @@ -49,6 +49,9 @@ protected function configure() InputOption::VALUE_NONE, 'If present, the job will be tracked' ); + + // Add old command name as alias + $this->setAliases(['enqueue']); } /** diff --git a/src/Console/WorkerCommand.php b/src/Console/WorkerCommand.php index 9268103..172c829 100644 --- a/src/Console/WorkerCommand.php +++ b/src/Console/WorkerCommand.php @@ -17,7 +17,7 @@ protected function configure() parent::configure(); $this - ->setName('worker') + ->setName('queue:worker') ->setDescription('Runs a Resque worker') ->addOption( 'queue', @@ -32,6 +32,9 @@ protected function configure() 'Interval in seconds to wait for between reserving jobs', 5 ); + + // Add old command name as alias + $this->setAliases(['worker']); } /**