diff --git a/lib/Resque.php b/lib/Resque.php index fa22ed1..a463bea 100644 --- a/lib/Resque.php +++ b/lib/Resque.php @@ -98,7 +98,11 @@ class Resque public static function push($queue, $item) { self::redis()->sadd('queues', $queue); - self::redis()->rpush('queue:' . $queue, json_encode($item)); + $length = self::redis()->rpush('queue:' . $queue, json_encode($item)); + if ($length < 1) { + return false; + } + return true; } /** diff --git a/lib/Resque/Job.php b/lib/Resque/Job.php index 7581ae3..8cedd4b 100755 --- a/lib/Resque/Job.php +++ b/lib/Resque/Job.php @@ -58,11 +58,13 @@ class Resque_Job ); } $id = md5(uniqid('', true)); - Resque::push($queue, array( + if (!Resque::push($queue, array( 'class' => $class, 'args' => array($args), 'id' => $id, - )); + ))) { + return false; + } if($monitor) { Resque_Job_Status::create($id);