Class: ActiveJob::QueueAdapters::ConeyIslandAdapter
- Inherits:
-
Object
- Object
- ActiveJob::QueueAdapters::ConeyIslandAdapter
- Defined in:
- lib/coney_island/coney_island_adapter.rb
Instance Method Summary collapse
-
#enqueue(job) ⇒ Object
ConeyIsland adapter for Active Job.
-
#enqueue_at(job, timestamp) ⇒ Object
:nodoc:.
- #get_retry_from_args(job) ⇒ Object
- #get_timeout_from_args(job) ⇒ Object
Instance Method Details
#enqueue(job) ⇒ Object
ConeyIsland adapter for Active Job
ConeyIsland is an industrial-strength background worker system for Rails using RabbitMQ. Read more about here.
To use ConeyIsland set the queue_adapter config to :coney_island
.
Rails.application.config.active_job.queue_adapter = :coney_island
12 13 14 15 |
# File 'lib/coney_island/coney_island_adapter.rb', line 12 def enqueue(job) #:nodoc: ConeyIsland::Submitter.submit job.class, :perform, args: job.arguments, work_queue: job.queue_name, timeout: get_timeout_from_args(job), retry_limit: get_retry_from_args(job), singleton: true end |
#enqueue_at(job, timestamp) ⇒ Object
:nodoc:
17 18 19 20 21 22 23 24 25 |
# File 'lib/coney_island/coney_island_adapter.rb', line 17 def enqueue_at(job, ) #:nodoc: params = {args: job.arguments, work_queue: job.queue_name, timeout: get_timeout_from_args(job), retry_limit: get_retry_from_args(job), singleton: true} delay = - Time.current.to_f if delay > 0 params[:delay] = delay.round end ConeyIsland::Submitter.submit job.class, :perform, params end |
#get_retry_from_args(job) ⇒ Object
31 32 33 |
# File 'lib/coney_island/coney_island_adapter.rb', line 31 def get_retry_from_args(job) job.class::RETRY_LIMIT if job.class.const_defined? :RETRY_LIMIT end |
#get_timeout_from_args(job) ⇒ Object
27 28 29 |
# File 'lib/coney_island/coney_island_adapter.rb', line 27 def get_timeout_from_args(job) job.class::TIMEOUT if job.class.const_defined? :TIMEOUT end |