Class: ActiveJob::QueueAdapters::LitejobAdapter

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

Overview

Litestack adapter for Active Job

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

Defined Under Namespace

Classes: Job

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ LitejobAdapter

Returns a new instance of LitejobAdapter.



17
18
19
20
21
# File 'lib/active_job/queue_adapters/litejob_adapter.rb', line 17

def initialize(options = {})
  # we currently don't honour individual options per job class
  # possible in the future?
  # Job.options = DEFAULT_OPTIONS.merge(options)
end

Instance Method Details

#enqueue(job) ⇒ Object

:nodoc:



27
28
29
30
# File 'lib/active_job/queue_adapters/litejob_adapter.rb', line 27

def enqueue(job) # :nodoc:
  Job.queue = job.queue_name
  Job.perform_async(job.serialize)
end

#enqueue_after_transaction_commit?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/active_job/queue_adapters/litejob_adapter.rb', line 23

def enqueue_after_transaction_commit?
  Job.options[:enqueue_after_transaction_commit]
end

#enqueue_at(job, time) ⇒ Object

:nodoc:



32
33
34
35
36
# File 'lib/active_job/queue_adapters/litejob_adapter.rb', line 32

def enqueue_at(job, time) # :nodoc:
  time  = time.from_now if time.respond_to?(:from_now) #is_a?(ActiveSupport::Duration)
  Job.queue = job.queue_name
  Job.perform_at(time, job.serialize)
end