Module: Sequel::ThreadedServerBlock

Defined in:
lib/sequel/extensions/server_block.rb

Overview

Adds with_server support for the sharded threaded connection pool.

Instance Method Summary collapse

Instance Method Details

#with_server(server) ⇒ Object

Set a default server/shard to use inside the block for the current thread.



107
108
109
110
111
112
113
114
# File 'lib/sequel/extensions/server_block.rb', line 107

def with_server(server)
  begin
    set_default_server(server)
    yield
  ensure
    clear_default_server
  end
end