Skip to content

Instantly share code, notes, and snippets.

@robvolk
Last active August 29, 2015 14:21
Show Gist options
  • Save robvolk/89f22d8cf251cfe7c30b to your computer and use it in GitHub Desktop.
Save robvolk/89f22d8cf251cfe7c30b to your computer and use it in GitHub Desktop.
Perform Sidekiq jobs async on any queue!
class HackTheWorld
include Sidekiq::Worker
include Sidekiq::AnyQueue
def perform(arg1, arg2)
// ...
end
end
HackTheWorld.perform_async_on_queue(:fast, "arg1", "arg2")
module Sidekiq
module AnyQueue
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def perform_async_on_queue(queue, *args)
Sidekiq::Client.push({
'class' => self,
'queue' => queue,
'args' => args
})
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment