Additional fix for threading tests to ensure a manager for a new thread is always set.
This commit is contained in:
Tyler Brock 2012-06-01 15:47:10 -04:00
parent a3555ba404
commit 4df2564519

View File

@ -401,10 +401,16 @@ module Mongo
end end
end end
def get_socket_from_pool(pool_type) def ensure_manager
if Thread.current[:managers] && Thread.current[:managers][self] != @manager Thread.current[:managers] ||= Hash.new
if Thread.current[:managers][self] != @manager
Thread.current[:managers][self] = @manager Thread.current[:managers][self] = @manager
end end
end
def get_socket_from_pool(pool_type)
ensure_manager
pool = case pool_type pool = case pool_type
when :primary when :primary