mirror of
https://github.com/idanoo/php-resque
synced 2025-07-01 05:32:20 +00:00
Unit tests pass
This commit is contained in:
parent
f379d3a36d
commit
bfbff5e58e
2 changed files with 15 additions and 4 deletions
|
@ -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)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue