mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
9fddcdd99e
1. Indentation 2. Spaces issues 3. Spelling correction 4. Grammar correction 5. Add #:nodoc: to all internal classes
26 lines
626 B
Ruby
26 lines
626 B
Ruby
require 'backburner'
|
|
|
|
module ActiveJob
|
|
module QueueAdapters
|
|
class BackburnerAdapter
|
|
class << self
|
|
def enqueue(job)
|
|
Backburner::Worker.enqueue JobWrapper, [ job.serialize ], queue: job.queue_name
|
|
end
|
|
|
|
def enqueue_at(job, timestamp)
|
|
delay = timestamp - Time.current.to_f
|
|
Backburner::Worker.enqueue JobWrapper, [ job.serialize ], queue: job.queue_name, delay: delay
|
|
end
|
|
end
|
|
|
|
class JobWrapper #:nodoc:
|
|
class << self
|
|
def perform(job_data)
|
|
Base.execute job_data
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|