Skip to content

Commit 37e2846

Browse files
author
Jonathon Hill
committed
fix: redelivery_delay does not work
RedisConsumer::processResult() creates the redelivered record prior to the RedisSubscription callback executing. The subscription callback attached with Enqueue\Consumption\QueueConsumer then invokes RedisConsumer::reject(). Calling acknowledge() here deletes the redelivered record which was created earlier. Thus, we should not create a new record in reject() and we should only call acknowledge() if we do not wish to redeliver. Resolves php-enqueue/enqueue-dev#1342
1 parent 2aa6a2f commit 37e2846

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

RedisConsumer.php

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,8 @@ public function reject(Message $message, bool $requeue = false): void
9393
{
9494
InvalidMessageException::assertMessageInstanceOf($message, RedisMessage::class);
9595

96-
$this->acknowledge($message);
97-
98-
if ($requeue) {
99-
$message = $this->getContext()->getSerializer()->toMessage($message->getReservedKey());
100-
$message->setRedelivered(true);
101-
102-
if ($message->getTimeToLive()) {
103-
$message->setHeader('expires_at', time() + $message->getTimeToLive());
104-
}
105-
106-
$payload = $this->getContext()->getSerializer()->toString($message);
107-
108-
$this->getRedis()->lpush($this->queue->getName(), $payload);
96+
if (!$requeue) {
97+
$this->acknowledge($message);
10998
}
11099
}
111100

0 commit comments

Comments
 (0)