This change will allow to use $message->getAttempts() when true === $message->isRedelivered() to find how many times this message has been requeue/redelivered. Such information is useful to decide if the message should be requeue to retry again later or rejected to be completely removed from the queue in case of error.
On \Enqueue\Redis\RedisConsumerHelperTrait::processResult() we already increment attempts header, so if we don't reset it when the message is requeue we will have the accurate information about how many times the message has been consumed.
This change will allow to use
$message->getAttempts()
whentrue === $message->isRedelivered()
to find how many times this message has been requeue/redelivered. Such information is useful to decide if the message should berequeue
to retry again later orrejected
to be completely removed from the queue in case of error.Something similar was asked on https://github.com/php-enqueue/enqueue-dev/issues/940 but the suggestion on https://github.com/php-enqueue/enqueue-dev/issues/940#issuecomment-1017173629 is about adding another header with a similar purpose than
attempts
.On
\Enqueue\Redis\RedisConsumerHelperTrait::processResult()
we already incrementattempts
header, so if we don't reset it when the message is requeue we will have the accurate information about how many times the message has been consumed.