Ensure we pass pool timeout to pool.
This commit is contained in:
parent
d171f75bb0
commit
f98c1099dc
|
@ -37,7 +37,8 @@ module Mongo
|
|||
RESPONSE_HEADER_SIZE = 20
|
||||
|
||||
attr_reader :logger, :size, :auths, :primary, :safe, :host_to_try,
|
||||
:pool_size, :connect_timeout, :primary_pool, :socket_class
|
||||
:pool_size, :connect_timeout, :pool_timeout,
|
||||
:primary_pool, :socket_class
|
||||
|
||||
# Counter for generating unique request ids.
|
||||
@@current_request_id = 0
|
||||
|
@ -670,7 +671,7 @@ module Mongo
|
|||
warn "The :timeout option has been deprecated " +
|
||||
"and will be removed in the 2.0 release. Use :pool_timeout instead."
|
||||
end
|
||||
@timeout = opts[:pool_timeout] || opts[:timeout] || 5.0
|
||||
@pool_timeout = opts[:pool_timeout] || opts[:timeout] || 5.0
|
||||
|
||||
# Timeout on socket read operation.
|
||||
@op_timeout = opts[:op_timeout] || nil
|
||||
|
@ -758,7 +759,7 @@ module Mongo
|
|||
def set_primary(node)
|
||||
host, port = *node
|
||||
@primary = [host, port]
|
||||
@primary_pool = Pool.new(self, host, port, :size => @pool_size, :timeout => @timeout)
|
||||
@primary_pool = Pool.new(self, host, port, :size => @pool_size, :timeout => @pool_timeout)
|
||||
end
|
||||
|
||||
## Low-level connection methods.
|
||||
|
|
|
@ -36,6 +36,7 @@ module Mongo
|
|||
def connect
|
||||
begin
|
||||
socket = nil
|
||||
puts "Creating connection in node to #{@host}:#{@port}"
|
||||
if @connection.connect_timeout
|
||||
Mongo::TimeoutHandler.timeout(@connection.connect_timeout, OperationTimeout) do
|
||||
socket = @connection.socket_class.new(@host, @port)
|
||||
|
|
|
@ -150,6 +150,7 @@ module Mongo
|
|||
# therefore, it runs within a mutex.
|
||||
def checkout_new_socket
|
||||
begin
|
||||
puts "Creating connection in pool to #{@host}:#{@port}"
|
||||
socket = self.connection.socket_class.new(@host, @port)
|
||||
socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
|
||||
rescue => ex
|
||||
|
|
|
@ -188,7 +188,7 @@ module Mongo
|
|||
@primary = member.host_port
|
||||
@primary_pool = Pool.new(self.connection, member.host, member.port,
|
||||
:size => self.connection.pool_size,
|
||||
:timeout => self.connection.connect_timeout,
|
||||
:timeout => self.connection.pool_timeout,
|
||||
:node => member)
|
||||
associate_tags_with_pool(member.tags, @primary_pool)
|
||||
end
|
||||
|
@ -198,7 +198,7 @@ module Mongo
|
|||
@secondaries << member.host_port
|
||||
pool = Pool.new(self.connection, member.host, member.port,
|
||||
:size => self.connection.pool_size,
|
||||
:timeout => self.connection.connect_timeout,
|
||||
:timeout => self.connection.pool_timeout,
|
||||
:node => member)
|
||||
@secondary_pools << pool
|
||||
associate_tags_with_pool(member.tags, pool)
|
||||
|
|
Loading…
Reference in New Issue