Class: Sync::EM::PG::ReConnectionPool
- Inherits:
-
EventMachine::Synchrony::ConnectionPool
- Object
- EventMachine::Synchrony::ConnectionPool
- Sync::EM::PG::ReConnectionPool
- Defined in:
- lib/sync-em/pg/sequel.rb
Instance Method Summary collapse
- #acquire(fiber) ⇒ Object
-
#initialize(opts, &block) ⇒ ReConnectionPool
constructor
A new instance of ReConnectionPool.
Constructor Details
#initialize(opts, &block) ⇒ ReConnectionPool
Returns a new instance of ReConnectionPool.
12 13 14 15 |
# File 'lib/sync-em/pg/sequel.rb', line 12 def initialize(opts, &block) @magick = block super end |
Instance Method Details
#acquire(fiber) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/sync-em/pg/sequel.rb', line 17 def acquire(fiber) if conn = @available.pop conn = @magick.call if conn.state != :connected @reserved[fiber.object_id] = conn conn else Fiber.yield @pending.push fiber acquire(fiber) end end |