Sha256: 46385ec27c54088063a4f82148f400b6c0f18412f19cdc9f76c2238b6a9d433c
Contents?: true
Size: 814 Bytes
Versions: 1
Compression:
Stored size: 814 Bytes
Contents
require 'sidekiq/client' module Sidekiq ## # Include this module in your worker class and you can easily create # asynchronous jobs: # # class HardWorker # include Sidekiq::Worker # # def perform(*args) # # do some work # end # end # # Then in your Rails app, you can do this: # # HardWorker.perform_async(1, 2, 3) # # Note that perform_async is a class method, perform is an instance method. module Worker def self.included(base) base.extend(ClassMethods) end def logger Sidekiq::Util.logger end module ClassMethods def perform_async(*args) Sidekiq::Client.push('class' => self.name, 'args' => args) end def queue(name) Sidekiq::Client.queues[self.name] = name.to_s end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-0.6.0 | lib/sidekiq/worker.rb |