Module: Sidekiq::Worker
- Defined in:
- lib/sidekiq/worker.rb
Overview
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.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #debug(msg) ⇒ Object
- #info(msg) ⇒ Object (also: #log)
Class Method Details
.included(base) ⇒ Object
23 24 25 |
# File 'lib/sidekiq/worker.rb', line 23 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#debug(msg) ⇒ Object
32 33 34 |
# File 'lib/sidekiq/worker.rb', line 32 def debug(msg) print "#{msg}\n" if $DEBUG end |
#info(msg) ⇒ Object Also known as: log
27 28 29 |
# File 'lib/sidekiq/worker.rb', line 27 def info(msg) print "#{msg}\n" end |