Class: ActiveJob::QueueAdapters::WorkhorseAdapter
- Inherits:
-
Object
- Object
- ActiveJob::QueueAdapters::WorkhorseAdapter
- Defined in:
- lib/active_job/queue_adapters/workhorse_adapter.rb
Overview
Workhorse adapter for ActiveJob.
Workhorse is a multi-threaded job backend with database queuing for Ruby. Jobs are persisted in the database using ActiveRecord. 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
-
#enqueue(job) ⇒ Workhorse::DbJob
private
Enqueues a job for immediate execution.
-
#enqueue_after_transaction_commit? ⇒ Boolean
Defines whether enqueuing should happen implicitly to after commit when called from inside a transaction.
-
#enqueue_at(job, timestamp = Time.now) ⇒ Workhorse::DbJob
private
Enqueues a job for execution at a specific time.
Instance Method Details
#enqueue(job) ⇒ Workhorse::DbJob
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Enqueues a job for immediate execution.
31 32 33 |
# File 'lib/active_job/queue_adapters/workhorse_adapter.rb', line 31 def enqueue(job) 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.
22 23 24 |
# File 'lib/active_job/queue_adapters/workhorse_adapter.rb', line 22 def enqueue_after_transaction_commit? false end |
#enqueue_at(job, timestamp = Time.now) ⇒ Workhorse::DbJob
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Enqueues a job for execution at a specific time.
41 42 43 |
# File 'lib/active_job/queue_adapters/workhorse_adapter.rb', line 41 def enqueue_at(job, = Time.now) Workhorse.enqueue_active_job(job, perform_at: ) end |