FEATURE: raise an event when a sidekiq job runs

This commit is contained in:
Sam 2017-10-23 17:30:17 +11:00
parent 55d096ee8b
commit 361fbfa518

View File

@ -76,7 +76,11 @@ class Sidekiq::Pausable
if Sidekiq.paused?
worker.class.perform_in(@delay, *msg['args'])
else
yield
start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
result = yield
duration = Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
DiscourseEvent.trigger(:sidekiq_job_ran, worker, msg, queue, duration)
result
end
end