class Polyphony::FiberConnectionPool
Sequel ConnectionPool that delegates to Polyphony::ResourcePool
.
Public Class Methods
new(db, opts = OPTS)
click to toggle source
Calls superclass method
# File lib/polyphony/adapters/sequel.rb, line 9 def initialize(db, opts = OPTS) super max_size = Integer(opts[:max_connections] || 4) @pool = Polyphony::ResourcePool.new(limit: max_size) { make_new(:default) } end
Public Instance Methods
hold(_server = nil) { |conn| ... }
click to toggle source
# File lib/polyphony/adapters/sequel.rb, line 15 def hold(_server = nil) @pool.acquire do |conn| yield conn rescue Polyphony::BaseException # The connection may be in an unrecoverable state if interrupted, # discard the connection from the pool so it isn't reused. @pool.discard! raise end end
max_size()
click to toggle source
# File lib/polyphony/adapters/sequel.rb, line 30 def max_size @pool.limit end
preconnect(_concurrent = false)
click to toggle source
# File lib/polyphony/adapters/sequel.rb, line 34 def preconnect(_concurrent = false) @pool.preheat! end
size()
click to toggle source
# File lib/polyphony/adapters/sequel.rb, line 26 def size @pool.size end