Permalink
Browse files

80c and comments

  • Loading branch information...
1 parent 0474a45 commit 6f52e83860d2e2011654958d5605abbabaf8218e @tmm1 committed Nov 28, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/dalli/client.rb
View
@@ -91,17 +91,18 @@ def get_multi(*keys)
servers_in_use.delete_if{ |s| s.sock.nil? }
break if servers_in_use.empty?
+ # calculate remaining timeout
elapsed = Time.now - start
timeout = servers_in_use.first.options[:socket_timeout]
if elapsed > timeout
readable = nil
else
- readable, _ = IO.select(servers_in_use.map(&:sock), nil, nil, timeout - elapsed)
+ sockets = servers_in_use.map(&:sock)
+ readable, _ = IO.select(sockets, nil, nil, timeout - elapsed)
end
if readable.nil?
- # no response within timeout
- # abort pending connections and return known values
+ # no response within timeout; abort pending connections
servers_in_use.each do |server|
server.multi_response_abort
end

0 comments on commit 6f52e83

Please sign in to comment.