Method: Pod4::ConnectionPool#initialize

Defined in:
lib/pod4/connection_pool.rb

#initialize(args) ⇒ ConnectionPool

As Connection, but with some options you can set.

  • max_clients – if this many clients are assigned to threads, wait until one is freed.

pass nil for no maximum. Tries to default to something sensible.

  • max_wait – throw a Pod4::PoolTimeout if you wait more than this time in seconds.

Pass nil to wait forever. Default is nil, because you would need to handle that timeout.

Note that the :interface parameter is optional here. You probably want one pool for all your models and interfaces, so you should leave it out.



80
81
82
83
84
85
86
# File 'lib/pod4/connection_pool.rb', line 80

def initialize(args)
  super(args)

  @max_clients = args[:max_clients] || DEFAULT_MAX_CLIENTS
  @max_wait    = args[:max_wait]
  @pool        = Pool.new
end