Unit tests pass

This commit is contained in:
Ruud Kamphuis 2013-05-29 09:29:24 +02:00
parent f379d3a36d
commit bfbff5e58e
2 changed files with 15 additions and 4 deletions

View File

@ -146,7 +146,17 @@ class Resque
return; 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)
);
} }
/** /**

View File

@ -100,12 +100,13 @@ class Resque_Job
*/ */
public static function reserveBlocking(array $queues, $timeout = null) public static function reserveBlocking(array $queues, $timeout = null)
{ {
$payload = Resque::blpop($queues, $timeout); $item = Resque::blpop($queues, $timeout);
if(!is_array($payload)) {
if(!is_array($item)) {
return false; return false;
} }
return new Resque_Job($payload->queue, $payload); return new Resque_Job($item['queue'], $item['payload']);
} }
/** /**