Brpoplpush timeout replies #272
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Brpoplpush timeout replies weren't handled correctly. When a user would call
Redis::brpoplpush()
and a timeout happened, the string*-1
was returned. With this fix it returns booleanfalse
, as expected.When the list given to brpoplpush has an element or receives an element before the timeout. That element is returned as a bulk reply. When the list stays empty until the timeout Redis returns a null multi bulk reply. This is different from rpoplpush, which always returns a bulk reply (null or with content). And it is different from brpop/blpop, they always return a multi bulk reply (null or with the key name, content pair).
My proposed fix is a quick one. The alternative would be untangling the brpoplpush and rpoplpush commands. They are now handled in much the same way, but they have very incompatible reply types.