Increment delivery counter on XCLAIM unless RETRYCOUNT specified

The XCLAIM docs state the XCLAIM increments the delivery counter for
messages. This PR makes the code match the documentation - which seems
like the desired behaviour - whilst still allowing RETRYCOUNT to be
specified manually.

My understanding of the way streamPropagateXCLAIM() works is that this
change will safely propagate to replicas since retry count is pulled
directly from the streamNACK struct.

Fixes #5194
This commit is contained in:
Steve Webster
2019-03-08 17:09:11 +00:00
parent 0f03312c23
commit f1e7df4b7c
2 changed files with 35 additions and 2 deletions

View File

@ -2279,8 +2279,12 @@ void xclaimCommand(client *c) {
/* Update the consumer and idle time. */
nack->consumer = consumer;
nack->delivery_time = deliverytime;
/* Set the delivery attempts counter if given. */
if (retrycount >= 0) nack->delivery_count = retrycount;
/* Set the delivery attempts counter if given, otherwise autoincrement */
if (retrycount >= 0) {
nack->delivery_count = retrycount;
} else {
nack->delivery_count++;
}
/* Add the entry in the new consumer local PEL. */
raxInsert(consumer->pel,buf,sizeof(buf),nack,NULL);
/* Send the reply for this entry. */