Skip to content

Commit

Permalink
RUBY-386 extend ismaster timeout to Connection
Browse files Browse the repository at this point in the history
  • Loading branch information
banker committed Dec 13, 2011
1 parent c308f9b commit 8fd89eb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/mongo/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,13 @@ def check_is_master(node)
socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
end

config = self['admin'].command({:ismaster => 1}, :socket => socket)
if @connect_timeout
Mongo::TimeoutHandler.timeout(@connect_timeout, OperationTimeout) do
config = self['admin'].command({:ismaster => 1}, :socket => socket)
end
else
config = self['admin'].command({:ismaster => 1}, :socket => socket)
end
rescue OperationFailure, SocketError, SystemCallError, IOError => ex
close
ensure
Expand Down

0 comments on commit 8fd89eb

Please sign in to comment.