diff --git a/lib/Resque.php b/lib/Resque.php index b715767..3ec80f7 100644 --- a/lib/Resque.php +++ b/lib/Resque.php @@ -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) + ); } /** diff --git a/lib/Resque/Job.php b/lib/Resque/Job.php index 7d90d0a..63cb203 100755 --- a/lib/Resque/Job.php +++ b/lib/Resque/Job.php @@ -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']); } /**