Method: Sequel::ShardedThreadedConnectionPool#disconnect

Defined in:
lib/sequel/connection_pool/sharded_threaded.rb

#disconnect(opts = OPTS) ⇒ Object

Removes all connections currently available on all servers, optionally yielding each connection to the given block. This method has the effect of disconnecting from the database, assuming that no connections are currently being used. If connections are being used, they are scheduled to be disconnected as soon as they are returned to the pool.

Once a connection is requested using #hold, the connection pool creates new connections to the database. Options:

:server

Should be a symbol specifing the server to disconnect from, or an array of symbols to specify multiple servers.



100
101
102
103
104
# File 'lib/sequel/connection_pool/sharded_threaded.rb', line 100

def disconnect(opts=OPTS)
  (opts[:server] ? Array(opts[:server]) : sync{@servers.keys}).each do |s|
    disconnect_connections(sync{disconnect_server_connections(s)})
  end
end