Method: ActiveRecord::ConnectionAdapters::ConnectionPool::Queue#poll
- Defined in:
- lib/active_record/connection_adapters/abstract/connection_pool.rb
#poll(timeout = nil) ⇒ Object
Remove the head of the queue.
If timeout is not given, remove and return the head the
queue if the number of available elements is strictly
greater than the number of threads currently waiting (that
is, don't jump ahead in line). Otherwise, return nil.
If timeout is given, block if it there is no element
available, waiting up to timeout seconds for an element to
become available.
Raises:
- ConnectionTimeoutError if
timeoutis given and no element becomes available aftertimeoutseconds,
133 134 135 136 137 138 139 140 141 |
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 133 def poll(timeout = nil) synchronize do if timeout no_wait_poll || wait_poll(timeout) else no_wait_poll end end end |