During a refresh Thread.current[:managers] has the potential to be nil.

This fix checks to make sure Thread.current[:managers] exists before
trying to access the managers hash.
This commit is contained in:
Tyler Brock 2012-06-01 14:08:26 -04:00
parent f55fc95bf4
commit 291a9334b6

View File

@ -402,7 +402,7 @@ module Mongo
end end
def get_socket_from_pool(pool_type) def get_socket_from_pool(pool_type)
if Thread.current[:managers][self] != @manager if Thread.current[:managers] && Thread.current[:managers][self] != @manager
Thread.current[:managers][self] = @manager Thread.current[:managers][self] = @manager
end end
@ -426,7 +426,7 @@ module Mongo
end end
def local_manager def local_manager
Thread.current[:managers][self] Thread.current[:managers][self] if Thread.current[:managers]
end end
def arbiters def arbiters