3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/pliny/sidekiq/job_logger.rb', line 3
def call(job, queue)
context = {
sidekiq: true,
job: job['class'],
job_id: job['jid'],
job_retry: job['retry'],
}
begin
start = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
log(context, job_logger: true, at: :start)
yield
log(context, job_logger: true, at: :finish, status: :done, duration: elapsed(start))
rescue Exception
log(context, job_logger: true, at: :finish, status: :fail, duration: elapsed(start))
raise
end
end
|