fakeredis icon indicating copy to clipboard operation
fakeredis copied to clipboard

brpoplpush function cannot accept timeout values as floats

Open Liam2032 opened this issue 4 years ago • 1 comments

Hi, I discovered today when using the function brpoplpush, setting a timeout with a float value will result in the returned error: timeout is negative. I have been able to reproduce this without issue, and this error is returned only for floats and not integer types. Additionally, when using the actual Redis package, this error is not present, and timeout values of float types are permitted. Doing some investigations, the _blocking function does state in its docstring: The timeout must be an integer, and 0 means infinite., hence, it does seem there is an implicit restriction of only integers being allowed (although this goes against the original Redis package). I think this needs to be updated to better reflect the Redis package.

Cheers :)

Liam2032 avatar Oct 15 '20 00:10 Liam2032

It looks like floating-point timeouts are a new feature in Redis 6 (see History section of https://redis.io/commands/brpoplpush). Fakeredis doesn't generally have much support for Redis 6 features, but pull requests are welcome.

bmerry avatar Oct 15 '20 05:10 bmerry