lib/moped/cluster.rb in moped-1.1.6 vs lib/moped/cluster.rb in moped-1.2.0
- old
+ new
@@ -17,9 +17,20 @@
# @since 1.0.0
def auth
@auth ||= {}
end
+ # Disconnects all nodes in the cluster. This should only be used in cases
+ # where you know you're not going to use the cluster on the thread anymore
+ # and need to force the connections to close.
+ #
+ # @return [ true ] True if the disconnect succeeded.
+ #
+ # @since 1.2.0
+ def disconnect
+ nodes.each { |node| node.disconnect } and true
+ end
+
# Initialize the new cluster.
#
# @example Initialize the cluster.
# Cluster.new([ "localhost:27017" ], down_interval: 20)
#