instance method poll

Ruby on Rails 4.2.9

Since v4.0.13

Available in: v4.0.13 v4.1.16 v4.2.9 v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

poll(timeout = nil)

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 timeout is given and no element

becomes available after timeout seconds,

Parameters

timeout opt = nil
Source
# File activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb, line 132
        def poll(timeout = nil)
          synchronize do
            if timeout
              no_wait_poll || wait_poll(timeout)
            else
              no_wait_poll
            end
          end
        end

Defined in activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb line 132 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ConnectionAdapters::ConnectionPool::Queue

Type at least 2 characters to search.

↑↓ navigate · open · esc close