From 1932888b442f962c587f5aeadda8a44aa05965f3 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Wed, 18 Jul 2018 12:08:43 +0300 Subject: [PATCH] Support XREAD BLOCK 0 --- commands.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/commands.go b/commands.go index 1debee1e..efaeb4d0 100644 --- a/commands.go +++ b/commands.go @@ -1376,7 +1376,7 @@ func (c *cmdable) XReadExt(opt *XReadExt) *XStreamSliceCmd { a = append(a, "count") a = append(a, opt.Count) } - if opt.Block > 0 { + if opt.Block >= 0 { a = append(a, "block") a = append(a, int64(opt.Block/time.Millisecond)) } @@ -1394,6 +1394,7 @@ func (c *cmdable) XReadExt(opt *XReadExt) *XStreamSliceCmd { func (c *cmdable) XRead(streams ...string) *XStreamSliceCmd { return c.XReadExt(&XReadExt{ Streams: streams, + Block: -1, }) } @@ -1401,6 +1402,7 @@ func (c *cmdable) XReadN(count int64, streams ...string) *XStreamSliceCmd { return c.XReadExt(&XReadExt{ Streams: streams, Count: count, + Block: -1, }) }