Class: Sidekiq::Processor
- Inherits:
-
Object
- Object
- Sidekiq::Processor
show all
- Includes:
- Celluloid, Util
- Defined in:
- lib/sidekiq/processor.rb
Instance Method Summary
collapse
Methods included from Util
#constantize, #err, #log, #verbose, #watchdog
Constructor Details
#initialize(boss) ⇒ Processor
Returns a new instance of Processor.
10
11
12
|
# File 'lib/sidekiq/processor.rb', line 10
def initialize(boss)
@boss = boss
end
|
Instance Method Details
#inspect ⇒ Object
33
34
35
|
# File 'lib/sidekiq/processor.rb', line 33
def inspect
"Sidekiq::Processor<#{object_id}>"
end
|
#invoke_chain(worker, msg) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/sidekiq/processor.rb', line 20
def invoke_chain(worker, msg)
chain = Sidekiq::Middleware::Chain.retrieve.dup
traverse_chain = lambda do
if chain.empty?
worker.perform(*msg['args'])
else
chain.shift.call(worker, msg, &traverse_chain)
end
end
traverse_chain.call
end
|
#process(msg) ⇒ Object
14
15
16
17
18
|
# File 'lib/sidekiq/processor.rb', line 14
def process(msg)
klass = constantize(msg['class'])
invoke_chain(klass.new, msg)
@boss.processor_done!(current_actor)
end
|