RUBY-386 extend ismaster timeout to Connection
This commit is contained in:
parent
c308f9b025
commit
8fd89eb2a4
@ -615,7 +615,13 @@ module Mongo
|
|||||||
socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
|
socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if @connect_timeout
|
||||||
|
Mongo::TimeoutHandler.timeout(@connect_timeout, OperationTimeout) do
|
||||||
config = self['admin'].command({:ismaster => 1}, :socket => socket)
|
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
|
rescue OperationFailure, SocketError, SystemCallError, IOError => ex
|
||||||
close
|
close
|
||||||
ensure
|
ensure
|
||||||
|
Loading…
Reference in New Issue
Block a user