From 16e862c1e22795acab869fa01ec5f8bcd7d400b3 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 23 Jan 2017 17:03:05 -0600 Subject: [PATCH] Send full job back into RedisQueue. --- src/Illuminate/Queue/Jobs/RedisJob.php | 4 ++-- src/Illuminate/Queue/RedisQueue.php | 8 ++++---- tests/Queue/QueueRedisJobTest.php | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Illuminate/Queue/Jobs/RedisJob.php b/src/Illuminate/Queue/Jobs/RedisJob.php index 3d471092c258..0dcd2567ce78 100644 --- a/src/Illuminate/Queue/Jobs/RedisJob.php +++ b/src/Illuminate/Queue/Jobs/RedisJob.php @@ -82,7 +82,7 @@ public function delete() { parent::delete(); - $this->redis->deleteReserved($this->queue, $this->reserved); + $this->redis->deleteReserved($this->queue, $this); } /** @@ -95,7 +95,7 @@ public function release($delay = 0) { parent::release($delay); - $this->redis->deleteAndRelease($this->queue, $this->reserved, $delay); + $this->redis->deleteAndRelease($this->queue, $this, $delay); } /** diff --git a/src/Illuminate/Queue/RedisQueue.php b/src/Illuminate/Queue/RedisQueue.php index 416aaec51a28..b9860a10cf1a 100644 --- a/src/Illuminate/Queue/RedisQueue.php +++ b/src/Illuminate/Queue/RedisQueue.php @@ -212,19 +212,19 @@ protected function retrieveNextJob($queue) * Delete a reserved job from the queue. * * @param string $queue - * @param string $job + * @param \Illuminate\Queues\Jobs\RedisJob $job * @return void */ public function deleteReserved($queue, $job) { - $this->getConnection()->zrem($this->getQueue($queue).':reserved', $job); + $this->getConnection()->zrem($this->getQueue($queue).':reserved', $job->getReservedJob()); } /** * Delete a reserved job from the reserved queue and release it. * * @param string $queue - * @param string $job + * @param \Illuminate\Queues\Jobs\RedisJob $job * @param int $delay * @return void */ @@ -234,7 +234,7 @@ public function deleteAndRelease($queue, $job, $delay) $this->getConnection()->eval( LuaScripts::release(), 2, $queue.':delayed', $queue.':reserved', - $job, $this->availableAt($delay) + $job->getReservedJob(), $this->availableAt($delay) ); } diff --git a/tests/Queue/QueueRedisJobTest.php b/tests/Queue/QueueRedisJobTest.php index 8fd05b49394a..22241bbc4b53 100644 --- a/tests/Queue/QueueRedisJobTest.php +++ b/tests/Queue/QueueRedisJobTest.php @@ -25,7 +25,7 @@ public function testDeleteRemovesTheJobFromRedis() { $job = $this->getJob(); $job->getRedisQueue()->shouldReceive('deleteReserved')->once() - ->with('default', json_encode(['job' => 'foo', 'data' => ['data'], 'attempts' => 2])); + ->with('default', $job); $job->delete(); } @@ -34,7 +34,7 @@ public function testReleaseProperlyReleasesJobOntoRedis() { $job = $this->getJob(); $job->getRedisQueue()->shouldReceive('deleteAndRelease')->once() - ->with('default', json_encode(['job' => 'foo', 'data' => ['data'], 'attempts' => 2]), 1); + ->with('default', $job, 1); $job->release(1); }