Class: Sidekiq::Processor
- Inherits:
-
Object
- Object
- Sidekiq::Processor
show all
- Includes:
- Celluloid, Util
- Defined in:
- lib/sidekiq/processor.rb
Constant Summary
Constants included
from Util
Util::EXPIRY
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Util
#constantize, #logger, #process_id, #redis, #watchdog
Constructor Details
#initialize(boss) ⇒ Processor
Returns a new instance of Processor.
26
27
28
|
# File 'lib/sidekiq/processor.rb', line 26
def initialize(boss)
@boss = boss
end
|
Class Method Details
.default_middleware ⇒ Object
Instance Method Details
#inspect ⇒ Object
44
45
46
|
# File 'lib/sidekiq/processor.rb', line 44
def inspect
"#<Processor #{to_s}>"
end
|
#process(msg, queue) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/sidekiq/processor.rb', line 30
def process(msg, queue)
klass = constantize(msg['class'])
worker = klass.new
defer do
stats(worker, msg, queue) do
Sidekiq.server_middleware.invoke(worker, msg, queue) do
worker.perform(*msg['args'])
end
end
end
@boss.processor_done!(current_actor)
end
|
#to_s ⇒ Object
48
49
50
|
# File 'lib/sidekiq/processor.rb', line 48
def to_s
@str ||= "#{hostname}:#{process_id}-#{Thread.current.object_id}:default"
end
|