PoolManager
Create a new set of connection pools.
The pool manager will by default use the original seed list passed to the connection objects, accessible via connection.seeds. In addition, the user may pass an additional list of seeds nodes discovered in real time. The union of these lists will be used when attempting to connect, with the newly-discovered nodes being used first.
# File lib/mongo/util/sharding_pool_manager.rb, line 15 def initialize(client, seeds=[]) super end
"Best" should be the member with the fastest ping time but connect/connect_to_members reinitializes @members
# File lib/mongo/util/sharding_pool_manager.rb, line 25 def best(members) Array(members.first) end
We want to refresh to the member with the fastest ping time but also want to minimize refreshes We're healthy if the primary is pingable. If this isn't the case, or the members have changed, set @refresh_required to true, and return. The config.mongos find can't be part of the connect call chain due to infinite recursion
# File lib/mongo/util/sharding_pool_manager.rb, line 45 def check_connection_health begin seeds = @client['config']['mongos'].find.to_a.map{|doc| doc['_id']} if @seeds != seeds @seeds = seeds @refresh_required = true end rescue Mongo::OperationFailure @refresh_required = true end end
Generated with the Darkfish Rdoc Generator 2.