Merge pull request #107 from danhunsaker/feature-queue-failure

Added enqueue failure detection
This commit is contained in:
Chris Boulton 2013-05-28 18:19:01 -07:00
commit 37cdec8e11
2 changed files with 9 additions and 3 deletions

View File

@ -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;
}
/**

View File

@ -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);