summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2020-01-08 10:10:11 +0100
committerantirez <antirez@gmail.com>2020-03-05 16:25:01 +0100
commitf93b2fa524cbaab1d8b0ab4d48bae8d4017fecee (patch)
tree9f55872b4cc0f84c5f0a4fa71079d4ed3f9e8abe
parent89682d96ea220e3a7901f57ce9b5a6df756af577 (diff)
downloadredis-f93b2fa524cbaab1d8b0ab4d48bae8d4017fecee.tar.gz
XCLAIM: Create the consumer only on successful claims.
Fixes #6744.
-rw-r--r--src/t_stream.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/t_stream.c b/src/t_stream.c
index 76eaf989b..5cfab8bf5 100644
--- a/src/t_stream.c
+++ b/src/t_stream.c
@@ -2255,7 +2255,7 @@ void xclaimCommand(client *c) {
}
/* Do the actual claiming. */
- streamConsumer *consumer = streamLookupConsumer(group,c->argv[3]->ptr,1);
+ streamConsumer *consumer = NULL;
void *arraylenptr = addDeferredMultiBulkLength(c);
size_t arraylen = 0;
for (int j = 5; j <= last_id_arg; j++) {
@@ -2307,9 +2307,11 @@ void xclaimCommand(client *c) {
if (nack->consumer)
raxRemove(nack->consumer->pel,buf,sizeof(buf),NULL);
/* Update the consumer and idle time. */
+ if (consumer == NULL)
+ consumer = streamLookupConsumer(group,c->argv[3]->ptr,1);
nack->consumer = consumer;
nack->delivery_time = deliverytime;
- /* Set the delivery attempts counter if given, otherwise
+ /* Set the delivery attempts counter if given, otherwise
* autoincrement unless JUSTID option provided */
if (retrycount >= 0) {
nack->delivery_count = retrycount;