IO#read_nonblock and IO#select #192

merged 8 commits into from Mar 14, 2012


None yet
3 participants

pietern commented Mar 13, 2012

This makes timeouts work again for MRI 1.9.

pietern added some commits Mar 13, 2012

Don't rely on implicit #to_s
JRuby 1.6 raises an exception without this patch.
Use floating point timeout duration
This reduces back and forth conversion, and defaults to the format that
is easier to work with.
Make MRI 1.9 behave properly w.r.t. timeouts
This change modifies the Ruby connection class to use IO#read_nonblock
and IO#select to make it time out when it is supposed to time out.

The previous implementation relied on raw socket timeouts, which don't
work for MRI 1.9. The use of IO#select is a little slower, but fixes
read timeouts. Connect timeouts are also enforced using IO#select in
this patch.

Inspiration for the dual socket implementation was drawn from the
`dalli` gem by Mike Perham.

djanowski added a commit that referenced this pull request Mar 14, 2012

Merge pull request #192 from redis/socket
IO#read_nonblock and IO#select

@djanowski djanowski merged commit 6810f18 into master Mar 14, 2012


I'd love to see this released. Thanks for that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment