return false when job creation is cancelled by beforeEnqueue

This commit is contained in:
Chris Boulton 2015-02-02 12:27:28 -08:00
parent 2308c3ced4
commit 8007705221

View File

@ -197,7 +197,7 @@ class Resque
* @param array $args Any optional arguments that should be passed when the job is executed. * @param array $args Any optional arguments that should be passed when the job is executed.
* @param boolean $trackStatus Set to true to be able to monitor the status of a job. * @param boolean $trackStatus Set to true to be able to monitor the status of a job.
* *
* @return string * @return string|boolean Job ID when the job was created, false if creation was cancelled due to beforeEnqueue
*/ */
public static function enqueue($queue, $class, $args = null, $trackStatus = false) public static function enqueue($queue, $class, $args = null, $trackStatus = false)
{ {
@ -212,7 +212,7 @@ class Resque
Resque_Event::trigger('beforeEnqueue', $hookParams); Resque_Event::trigger('beforeEnqueue', $hookParams);
} }
catch(Resque_Job_DontCreate $e) { catch(Resque_Job_DontCreate $e) {
return $id; return false;
} }
Resque_Job::create($queue, $class, $args, $trackStatus, $id); Resque_Job::create($queue, $class, $args, $trackStatus, $id);