mirror of
https://github.com/idanoo/php-resque.git
synced 2024-11-22 00:11:53 +00:00
Merge pull request #107 from danhunsaker/feature-queue-failure
Added enqueue failure detection
This commit is contained in:
commit
37cdec8e11
@ -98,7 +98,11 @@ class Resque
|
|||||||
public static function push($queue, $item)
|
public static function push($queue, $item)
|
||||||
{
|
{
|
||||||
self::redis()->sadd('queues', $queue);
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,11 +58,13 @@ class Resque_Job
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
$id = md5(uniqid('', true));
|
$id = md5(uniqid('', true));
|
||||||
Resque::push($queue, array(
|
if (!Resque::push($queue, array(
|
||||||
'class' => $class,
|
'class' => $class,
|
||||||
'args' => array($args),
|
'args' => array($args),
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
));
|
))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if($monitor) {
|
if($monitor) {
|
||||||
Resque_Job_Status::create($id);
|
Resque_Job_Status::create($id);
|
||||||
|
Loading…
Reference in New Issue
Block a user