11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/rekiq/middleware/work_overseer.rb', line 11
def call(worker, msg, queue)
return yield unless msg.key?('rq:ctr')
@worker = worker
@worker_name = worker.class.name
@msg = msg
@queue = queue
@contract = Contract.from_hash(msg['rq:ctr'])
set_rekiq_worker_attributes
if cancel_worker?
return logger.info "worker #{@worker_name} was canceled"
end
if msg.key?('rq:sdl')
msg.delete('rq:sdl')
else
return yield
end
begin
reschedule unless @contract.schedule_post_work?
yield
ensure
reschedule if @contract.schedule_post_work?
end
end
|