mirror of
https://github.com/idanoo/php-resque.git
synced 2024-11-22 00:11:53 +00:00
Unit tests pass
This commit is contained in:
parent
f379d3a36d
commit
bfbff5e58e
@ -146,7 +146,17 @@ class Resque
|
||||
return;
|
||||
}
|
||||
|
||||
return json_decode($item[1], true);
|
||||
/**
|
||||
* Normally the Resque_Redis class returns queue names without the prefix
|
||||
* But the blpop is a bit different. It returns the name as prefix:queue:name
|
||||
* So we need to strip off the prefix:queue: part
|
||||
*/
|
||||
$queue = substr($item[0], strlen(self::redis()->getPrefix() . 'queue:'));
|
||||
|
||||
return array(
|
||||
'queue' => $queue,
|
||||
'payload' => json_decode($item[1], true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,12 +100,13 @@ class Resque_Job
|
||||
*/
|
||||
public static function reserveBlocking(array $queues, $timeout = null)
|
||||
{
|
||||
$payload = Resque::blpop($queues, $timeout);
|
||||
if(!is_array($payload)) {
|
||||
$item = Resque::blpop($queues, $timeout);
|
||||
|
||||
if(!is_array($item)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return new Resque_Job($payload->queue, $payload);
|
||||
return new Resque_Job($item['queue'], $item['payload']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user