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
1 changed files with 8 additions and 2 deletions

View File

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