Class: ActiveJob::QueueAdapters::WorkhorseAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/active_job/queue_adapters/workhorse_adapter.rb

Overview

Workhorse adapter for Active Job

Workhorse is a multi-threaded job backend with database queuing for ruby. Jobs are persisted in the database using ActiveRecird. Read more about Workhorse here.

To use Workhorse, set the queue_adapter config to :workhorse.

Rails.application.config.active_job.queue_adapter = :workhorse

Instance Method Summary collapse

Instance Method Details

#enqueue(job) ⇒ Object

:nodoc:



21
22
23
# File 'lib/active_job/queue_adapters/workhorse_adapter.rb', line 21

def enqueue(job) # :nodoc:
  Workhorse.enqueue_active_job(job)
end

#enqueue_after_transaction_commit?Boolean

Defines whether enqueuing should happen implicitly to after commit when called from inside a transaction. Most adapters should return true, but some adapters that use the same database as Active Record and are transaction aware can return false to continue enqueuing jobs as part of the transaction.

Returns:

  • (Boolean)


17
18
19
# File 'lib/active_job/queue_adapters/workhorse_adapter.rb', line 17

def enqueue_after_transaction_commit?
  false
end

#enqueue_at(job, timestamp = Time.now) ⇒ Object

:nodoc:



25
26
27
# File 'lib/active_job/queue_adapters/workhorse_adapter.rb', line 25

def enqueue_at(job, timestamp = Time.now) # :nodoc:
  Workhorse.enqueue_active_job(job, perform_at: timestamp)
end