class ActiveRecord::ConnectionPool
Public Instance Methods
acquire(fiber)
click to toggle source
Calls superclass method
# File lib/emmy_extends/activerecord/connection_pool.rb, line 16 def acquire(fiber) return @reserved[fiber.object_id] if @reserved[fiber.object_id] super end
affected_rows(*args, &blk)
click to toggle source
# File lib/emmy_extends/activerecord/connection_pool.rb, line 25 def affected_rows(*args, &blk) execute(false) do |conn| conn.send(:affected_rows, *args, &blk) end end
connection()
click to toggle source
# File lib/emmy_extends/activerecord/connection_pool.rb, line 21 def connection acquire(Fiber.current) end
execute(async) { |conn| ... }
click to toggle source
# File lib/emmy_extends/activerecord/connection_pool.rb, line 4 def execute(async) f = Fiber.current begin conn = acquire(f) conn.acquired_for_connection_pool += 1 yield conn ensure conn.acquired_for_connection_pool -= 1 release(f) if !async && conn.acquired_for_connection_pool == 0 end end