Created
July 10, 2015 01:17
-
-
Save owenr/b5d9e19b0fa2cda361c6 to your computer and use it in GitHub Desktop.
ActiveJob adapter for TorqueBox 4.0 scheduler (torquebox-scheduling). Seems to work; place into config/initializers/ and specify the adapter in config/application.rb as follows: config.active_job.queue_adapter = :torquebox_scheduler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'torquebox-scheduling' | |
module ActiveJob | |
module QueueAdapters | |
class TorqueboxSchedulerAdapter | |
class << self | |
def enqueue(job) #:nodoc: | |
TorqueBox::Scheduling::Scheduler.schedule(job.hash, in: 35) do | |
Base.execute(job.serialize) | |
end | |
end | |
def enqueue_at(job, timestamp) #:nodoc: | |
TorqueBox::Scheduling::Scheduler.schedule(job.hash, at: timestamp) do | |
Base.execute(job.serialize) | |
end | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment