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(default_server, read_only_server = default_server) ⇒ Object

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


127
128
129
130
131
132
133
134
# File 'lib/sequel/extensions/server_block.rb', line 127

def with_server(default_server, read_only_server=default_server)
  begin
    set_default_server(default_server, read_only_server)
    yield
  ensure
    clear_default_server
  end
end