@@ -219,41 +219,35 @@ def context
219219 # @deprecated No longer necessary with Server Selection specification.
220220 def connectable? ; end
221221
222- # Disconnect the server from the connection .
222+ # Disconnect the driver from this server .
223223 #
224- # @example Disconnect the server.
225- # server.disconnect!
224+ # Disconnects all idle connections to this server in its connection pool,
225+ # if any exist. Stops the populator of the connection pool, if it is
226+ # running. Does not immediately close connections which are presently
227+ # checked out (i.e. in use) - such connections will be closed when they
228+ # are returned to their respective connection pools. Stop the server's
229+ # background monitor.
226230 #
227- # @param [ Boolean ] wait Whether to wait for background threads to
228- # finish running.
229- #
230- # @return [ true ] Always true with no exception.
231+ # @return [ true ] Always true.
231232 #
232233 # @since 2.0.0
233- def disconnect! ( wait = false )
234+ def disconnect!
234235 if monitor
235236 monitor . stop!
236237 end
237238 _pool = @pool_lock . synchronize do
238239 @pool
239240 end
240241 if _pool
241- if wait
242- _pool . close ( wait : wait )
243- # Need to clear @pool as otherwise the old pool will continue to be
244- # used if this server is reconnected in the future.
245- @pool = nil
246- else
247- # For backwards compatibility we disconnect/clear the pool rather
248- # than close it here. We also stop the populator which allows the
249- # the pool to continue providing connections but stops it from
250- # connecting in background on clients/servers that are in fact
251- # intended to be closed and no longer used.
252- begin
253- _pool . disconnect! ( stop_populator : true )
254- rescue Error ::PoolClosedError
255- # If the pool was already closed, we don't need to do anything here.
256- end
242+ # For backwards compatibility we disconnect/clear the pool rather
243+ # than close it here. We also stop the populator which allows the
244+ # the pool to continue providing connections but stops it from
245+ # connecting in background on clients/servers that are in fact
246+ # intended to be closed and no longer used.
247+ begin
248+ _pool . disconnect! ( stop_populator : true )
249+ rescue Error ::PoolClosedError
250+ # If the pool was already closed, we don't need to do anything here.
257251 end
258252 end
259253 @connected = false
0 commit comments