Method: Sequel::ShardedSingleConnectionPool#hold

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

#hold(server = :default) ⇒ Object

Yields the connection to the supplied block for the given server. This method simulates the ConnectionPool#hold API.

[View source]

57
58
59
60
61
62
63
# File 'lib/sequel/connection_pool/sharded_single.rb', line 57

def hold(server=:default)
  server = pick_server(server)
  yield(@conns[server] ||= make_new(server))
rescue Sequel::DatabaseDisconnectError, *@error_classes => e
  disconnect_server(server) if disconnect_error?(e)
  raise
end