Sha256: 05a15f7937adc25a0aab0be843a72308b4d9cd9ff96244f943562937f976226a
Contents?: true
Size: 650 Bytes
Versions: 33
Compression:
Stored size: 650 Bytes
Contents
# frozen_string_literal: true module Cron # # Take care of job metrics # class RecordDelayedJobMetrics < Job cron_tab_entry :daily # # Main driver method # def execute Delayed::Jobs::Run.each do |run| metric = Delayed::Jobs::Metric.find_or_create_by! name: run.name metric.set count: metric.count + 1, total: run.duration + metric.total, max: [metric.max, run.duration].max, min: [metric.min, run.duration].min, last_run_at: [run.locked_at, metric.last_run_at].compact.max run.destroy! end end end end
Version data entries
33 entries across 33 versions & 1 rubygems