Skip to content

Commit 9120e31

Browse files
committed
Make tarcieri happy
1 parent d495eff commit 9120e31

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

lib/redis/connection/ruby.rb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ module SocketMixin
2727
CRLF = "\r\n".freeze
2828

2929
# Exceptions raised during non-blocking I/O ops that require retrying the op
30-
NBIO_READ_EXCEPTIONS = [Errno::EWOULDBLOCK, Errno::EAGAIN]
31-
NBIO_WRITE_EXCEPTIONS = [Errno::EWOULDBLOCK, Errno::EAGAIN]
32-
if RUBY_VERSION >= "1.9.3"
33-
NBIO_READ_EXCEPTIONS << IO::WaitReadable
34-
NBIO_WRITE_EXCEPTIONS << IO::WaitWritable
30+
if RUBY_VERSION >= "1.9.0"
31+
NBIO_READ_EXCEPTIONS = [IO::WaitReadable]
32+
NBIO_WRITE_EXCEPTIONS = [IO::WaitWritable]
33+
else
34+
NBIO_READ_EXCEPTIONS = [Errno::EWOULDBLOCK, Errno::EAGAIN]
35+
NBIO_WRITE_EXCEPTIONS = [Errno::EWOULDBLOCK, Errno::EAGAIN]
3536
end
3637

3738
def initialize(*args)
@@ -104,14 +105,14 @@ def _write_to_socket(data)
104105
begin
105106
write_nonblock(data)
106107

107-
rescue *NBIO_WRITE_EXCEPTIONS
108-
if IO.select(nil, [self], nil, @write_timeout)
108+
rescue *NBIO_READ_EXCEPTIONS
109+
if IO.select([self], nil, nil, @write_timeout)
109110
retry
110111
else
111112
raise Redis::TimeoutError
112113
end
113-
rescue *NBIO_READ_EXCEPTIONS
114-
if IO.select([self], nil, nil, @write_timeout)
114+
rescue *NBIO_WRITE_EXCEPTIONS
115+
if IO.select(nil, [self], nil, @write_timeout)
115116
retry
116117
else
117118
raise Redis::TimeoutError

0 commit comments

Comments
 (0)