module DBQ::Queue::ClassMethods
Private Instance Methods
check_out_item()
click to toggle source
# File lib/dbq/queue.rb, line 11 def check_out_item thread = Thread.new do item = nil connection_pool.with_connection do transaction do item = where(checked_out_at: nil) .order(id: :asc).limit(1).lock(true).first item.try(:check_out!) end end item end thread.abort_on_exception = true thread.value end