1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activejob/lib/active_job/queue_adapters/backburner_adapter.rb
Akshay Vishnoi 9fddcdd99e [ci skip] AJ docs fixes
1. Indentation
2. Spaces issues
3. Spelling correction
4. Grammar correction
5. Add #:nodoc: to all internal classes
2014-09-18 01:16:53 +05:30

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