Class: ActiveJob::QueueAdapters::SqewerAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/sqewer/extensions/active_job_adapter.rb

Overview

Handle Rails ActiveJob through sqewer. Set it up like so:

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

Defined Under Namespace

Classes: Performable

Instance Method Summary collapse

Instance Method Details

#enqueue(*args) ⇒ Object



64
65
66
67
68
# File 'lib/sqewer/extensions/active_job_adapter.rb', line 64

def enqueue(*args)
  wrapped_job = Performable.from_active_job(active_job)

  Sqewer.submit!(wrapped_job)
end

#enqueue_at(*args) ⇒ Object



70
71
72
73
74
75
76
# File 'lib/sqewer/extensions/active_job_adapter.rb', line 70

def enqueue_at(*args)
  wrapped_job = Performable.from_active_job(active_job)

  delta_t = (timestamp - Time.now.to_i).to_i

  Sqewer.submit!(wrapped_job, delay_seconds: delta_t)
end