Skip to content

Commit

Permalink
pass duration in logs as milliseconds (integer)
Browse files Browse the repository at this point in the history
  • Loading branch information
alachaum committed Apr 9, 2024
1 parent 2c1a884 commit a0badfc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/cloudtasker/worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,16 @@ def execute
resp = execute_middleware_chain

# Log job completion and return result
logger.info("Job done after #{job_duration}s") { { duration: "#{job_duration}s" } }
logger.info("Job done after #{job_duration}s") { { duration: job_duration * 1000 } }
resp
rescue DeadWorkerError => e
logger.info("Job dead after #{job_duration}s and #{job_retries} retries") { { duration: "#{job_duration}s" } }
logger.info("Job dead after #{job_duration}s and #{job_retries} retries") { { duration: job_duration * 1000 } }
raise(e)
rescue RetryWorkerError => e
logger.info("Job done after #{job_duration}s (retry requested)") { { duration: "#{job_duration}s" } }
logger.info("Job done after #{job_duration}s (retry requested)") { { duration: job_duration * 1000 } }
raise(e)
rescue StandardError => e
logger.info("Job failed after #{job_duration}s") { { duration: "#{job_duration}s" } }
logger.info("Job failed after #{job_duration}s") { { duration: job_duration * 1000 } }
raise(e)
end

Expand Down

0 comments on commit a0badfc

Please sign in to comment.