summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2017-09-12 16:19:26 +0200
committerantirez <antirez@gmail.com>2017-11-04 17:39:26 +0100
commitacfecfdf62fbc2c8e63713e01a951220b646fd6d (patch)
treec09608f3436566aa7a0b74b3b32b4219ef792399
parent8ed48e832d5b3e6e8849be29baca929b0dd7b9a0 (diff)
downloadredis-acfecfdf62fbc2c8e63713e01a951220b646fd6d.tar.gz
Streams: fix bug in XREAD last received ID processing.
-rw-r--r--src/t_stream.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/t_stream.c b/src/t_stream.c
index 3b0072ec8..a8230109c 100644
--- a/src/t_stream.c
+++ b/src/t_stream.c
@@ -524,9 +524,9 @@ void xreadCommand(client *c) {
/* Specifying "$" as last-known-id means that the client wants to be
* served with just the messages that will arrive into the stream
* starting from now. */
+ int id_idx = i - streams_arg - streams_count;
if (strcmp(c->argv[i]->ptr,"$") == 0) {
robj *o = lookupKeyRead(c->db,c->argv[i-streams_count]);
- int id_idx = i - streams_arg - streams_count;
if (o) {
stream *s = o->ptr;
ids[id_idx] = s->last_id;
@@ -536,7 +536,8 @@ void xreadCommand(client *c) {
}
continue;
}
- if (streamParseIDOrReply(c,c->argv[i],ids+i,0) != C_OK) goto cleanup;
+ if (streamParseIDOrReply(c,c->argv[i],ids+id_idx,0) != C_OK)
+ goto cleanup;
}
/* Try to serve the client synchronously. */