Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Brpoplpush timeout replies #272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 16, 2013
Merged

Conversation

pepve
Copy link
Contributor

@pepve pepve commented Nov 16, 2012

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 boolean false, 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.

@twogood
Copy link

twogood commented Jan 11, 2013

I'd like to vote for this patch. Brpoplpush should return false on timeout, not "*-1".

@michael-grunder
Copy link
Member

I've done preliminary testing on this pull request and it appears to work just fine. It makes me a little nervous to short-circuit redis_sock_read in that way, but the way I read it it should be fine.

I am going to do a couple more tests (because I'm paranoid) and then I'll merge this guy

Thanks! :)

michael-grunder pushed a commit that referenced this pull request Jan 16, 2013
Thanks for the pull, merging.
@michael-grunder michael-grunder merged commit 07369ed into phpredis:master Jan 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants