Class: Que::Adapters::ActiveRecord

Inherits:
Base
  • Object
show all
Defined in:
lib/que/adapters/active_record.rb

Defined Under Namespace

Classes: TransactionCallback

Instance Method Summary collapse

Methods inherited from Base

#execute, #in_transaction?, #initialize

Constructor Details

This class inherits a constructor from Que::Adapters::Base

Instance Method Details

#checkoutObject



4
5
6
# File 'lib/que/adapters/active_record.rb', line 4

def checkout
  checkout_activerecord_adapter { |conn| yield conn.raw_connection }
end

#wake_worker_after_commitObject



8
9
10
11
12
13
14
15
# File 'lib/que/adapters/active_record.rb', line 8

def wake_worker_after_commit
  # Works with ActiveRecord 3.2 and 4 (possibly earlier, didn't check)
  if in_transaction?
    checkout_activerecord_adapter { |adapter| adapter.add_transaction_record(TransactionCallback.new) }
  else
    Que.wake!
  end
end