Merge pull request #810 from go-redis/fix/xread-block-0

Support XREAD BLOCK 0
This commit is contained in:
Vladimir Mihailenco 2018-07-18 12:32:23 +03:00 committed by GitHub
commit da8ef0efa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -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,
})
}