From fd02fee4bd146277e21a2aed2247a7e04e58325c Mon Sep 17 00:00:00 2001 From: Luqman Sungkar Date: Thu, 31 Oct 2019 12:54:21 +0700 Subject: [PATCH 1/2] change the job id to be something that are not stored in redis, so that we can still push a job from inside a multi block --- src/drivers/redis/Queue.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drivers/redis/Queue.php b/src/drivers/redis/Queue.php index 994d9e865f..6c80a2d444 100644 --- a/src/drivers/redis/Queue.php +++ b/src/drivers/redis/Queue.php @@ -191,7 +191,7 @@ protected function pushMessage($message, $ttr, $delay, $priority) throw new NotSupportedException('Job priority is not supported in the driver.'); } - $id = $this->redis->incr("$this->channel.message_id"); + $id = uniqid('', true); $this->redis->hset("$this->channel.messages", $id, "$ttr;$message"); if (!$delay) { $this->redis->lpush("$this->channel.waiting", $id); From 0a2ca6f891248bcf434f84ad2dfbb108c1790b05 Mon Sep 17 00:00:00 2001 From: Luqman Sungkar Date: Thu, 31 Oct 2019 13:54:23 +0700 Subject: [PATCH 2/2] remove the id checking as now id is not an incremental number --- src/drivers/redis/Queue.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/drivers/redis/Queue.php b/src/drivers/redis/Queue.php index 6c80a2d444..9dbf93edf4 100644 --- a/src/drivers/redis/Queue.php +++ b/src/drivers/redis/Queue.php @@ -73,10 +73,6 @@ public function run($repeat, $timeout = 0) */ public function status($id) { - if (!is_numeric($id) || $id <= 0) { - throw new InvalidArgumentException("Unknown message ID: $id."); - } - if ($this->redis->hexists("$this->channel.attempts", $id)) { return self::STATUS_RESERVED; }