Module: Sidekiq::Worker

Included in:
Extensions::DelayedMailer, Extensions::DelayedModel
Defined in:
lib/sidekiq/worker.rb,
lib/sidekiq/testing.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

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

#loggerObject


27
28
29
# File 'lib/sidekiq/worker.rb', line 27

def logger
  Sidekiq::Util.logger
end