class ActiveRecord::ConnectionAdapters::ConnectionPool::Queue
def wait_poll(timeout)
Waits on the queue up to +timeout+ seconds, then removes and
def wait_poll(timeout) @num_waiting += 1 t0 = Process.clock_gettime(Process::CLOCK_MONOTONIC) elapsed = 0 loop do ActiveSupport::Dependencies.interlock.permit_concurrent_loads do @cond.wait(timeout - elapsed) end return remove if any? elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - t0 if elapsed >= timeout msg = "could not obtain a connection from the pool within %0.3f seconds (waited %0.3f seconds); all pooled connections were in use" % [timeout, elapsed] raise ConnectionTimeoutError, msg end end ensure @num_waiting -= 1 end