From 7fbac1c6c09080da698f4c3256356cb896465692 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 23 Jan 2017 15:41:17 -0600 Subject: [PATCH] tweak extension points --- src/Illuminate/Queue/RedisQueue.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Illuminate/Queue/RedisQueue.php b/src/Illuminate/Queue/RedisQueue.php index 2d776188d9f9..416aaec51a28 100644 --- a/src/Illuminate/Queue/RedisQueue.php +++ b/src/Illuminate/Queue/RedisQueue.php @@ -38,13 +38,6 @@ class RedisQueue extends Queue implements QueueContract */ protected $retryAfter = 60; - /** - * The last delayed payload sent by the queue. - * - * @var string - */ - protected $lastDelayedPayload; - /** * Create a new Redis queue instance. * @@ -80,7 +73,7 @@ public function size($queue = null) /** * Push a new job onto the queue. * - * @param string $job + * @param object|string $job * @param mixed $data * @param string $queue * @return mixed @@ -109,15 +102,26 @@ public function pushRaw($payload, $queue = null, array $options = []) * Push a new job onto the queue after a delay. * * @param \DateTime|int $delay - * @param string $job + * @param object|string $job * @param mixed $data * @param string $queue * @return mixed */ public function later($delay, $job, $data = '', $queue = null) { - $this->lastDelayedPayload = $payload = $this->createPayload($job, $data); + return $this->laterRaw($delay, $this->createPayload($job, $data), $queue); + } + /** + * Push a raw job onto the queue after a delay. + * + * @param \DateTime|int $delay + * @param string $payload + * @param string $queue + * @return mixed + */ + protected function laterRaw($delay, $payload, $queue = null) + { $this->getConnection()->zadd( $this->getQueue($queue).':delayed', $this->availableAt($delay), $payload );