lib/sidekiq/hierarchy/server/middleware.rb in sidekiq-hierarchy-0.1.2 vs lib/sidekiq/hierarchy/server/middleware.rb in sidekiq-hierarchy-0.1.3
- old
+ new
@@ -12,13 +12,14 @@
# Must propagate return value upwards.
# Since jobs raise errors for signalling, those must be propagated as well.
def call(worker, msg, queue)
if msg['workflow'] == true # root job -- start of a new workflow
Sidekiq::Hierarchy.current_workflow = Workflow.find_by_jid(worker.jid)
+ Sidekiq::Hierarchy.current_jid = worker.jid
elsif msg['workflow'].is_a?(String) # child job -- inherit parent's workflow
Sidekiq::Hierarchy.current_workflow = Workflow.find_by_jid(msg['workflow'])
+ Sidekiq::Hierarchy.current_jid = worker.jid
end
- Sidekiq::Hierarchy.current_jid = worker.jid
Sidekiq::Hierarchy.record_job_running
ret = yield
Sidekiq::Hierarchy.record_job_complete