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.



112
113
114
115
116
117
118
119
# File 'lib/sequel/extensions/server_block.rb', line 112

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