From b5be5093fecd02f4ee537af5ad473899bb6d7a61 Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 8 Sep 2017 20:48:28 +0200 Subject: [PATCH] Streams: fix XREAD timeout handling, zero is valid. --- src/t_stream.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/t_stream.c b/src/t_stream.c index 0358e644..afa8224c 100644 --- a/src/t_stream.c +++ b/src/t_stream.c @@ -398,7 +398,7 @@ void xlenCommand(client *c) { * [RETRY ] STREAMS key_1 key_2 ... key_N * ID_1 ID_2 ... ID_N */ void xreadCommand(client *c) { - long long timeout = 0; + long long timeout = -1; /* -1 means, no BLOCK argument given. */ long long count = 0; int streams_count = 0; int streams_arg = 0; @@ -499,7 +499,7 @@ void xreadCommand(client *c) { } /* Block if needed. */ - if (timeout) { + if (timeout != -1) { /* If we are inside a MULTI/EXEC and the list is empty the only thing * we can do is treating it as a timeout (even with timeout 0). */ if (c->flags & CLIENT_MULTI) {