summaryrefslogtreecommitdiff
path: root/src/t_stream.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2020-01-08 10:10:11 +0100
committerantirez <antirez@gmail.com>2020-01-08 10:10:11 +0100
commit7080a28efc28bd3a3004bd37c9b85d58233fc1ed (patch)
tree5ce9591aee02a6facd5aeec674c26ba40faa4a82 /src/t_stream.c
parent0af467d18f9d12b137af3b709c0af579c29d8414 (diff)
downloadredis-7080a28efc28bd3a3004bd37c9b85d58233fc1ed.tar.gz
XCLAIM: Create the consumer only on successful claims.
Fixes #6744.
Diffstat (limited to 'src/t_stream.c')
-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 3d46ca0da..ae57202c1 100644
--- a/src/t_stream.c
+++ b/src/t_stream.c
@@ -2246,7 +2246,7 @@ void xclaimCommand(client *c) {
}
/* Do the actual claiming. */
- streamConsumer *consumer = streamLookupConsumer(group,c->argv[3]->ptr,1);
+ streamConsumer *consumer = NULL;
void *arraylenptr = addReplyDeferredLen(c);
size_t arraylen = 0;
for (int j = 5; j <= last_id_arg; j++) {
@@ -2298,9 +2298,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;