Skip to content

Commit ed28d26

Browse files
committed
Make the worker available in the after_fork hook
1 parent ccfa00b commit ed28d26

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/resque/worker.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def process(job = nil)
143143
return unless job ||= reserve
144144

145145
begin
146+
job.worker = self
146147
run_hook :after_fork, job
147148
working_on job
148149
job.perform
@@ -332,7 +333,6 @@ def unregister_worker
332333
# Given a job, tells Redis we're working on it. Useful for seeing
333334
# what workers are doing and when.
334335
def working_on(job)
335-
job.worker = self
336336
data = encode \
337337
:queue => job.queue,
338338
:run_at => Time.now.to_s,

0 commit comments

Comments
 (0)