Sha256: 39a4847057feafc76145ecbdeeac20df58f697a4ebb08521fd8667a3551a925e

Contents?: true

Size: 783 Bytes

Versions: 19

Compression:

Stored size: 783 Bytes

Contents

module Marty::Diagnostic; class ScheduledJobs < Base
  self.aggregatable = false

  diagnostic_fn do
    logs = ::Marty::BackgroundJob::Log.
      order(job_class: :asc, status: :desc, id: :desc).
      select('DISTINCT ON(job_class, status) *').
      where.not(status: :failure_ignore).
      first(1000)

    failed_total = ::Marty::BackgroundJob::Log.where(status: :failure).count

    result = logs.each_with_object({}) do |log, hash|
      message = "Status: #{log.status}, last_run: #{log.created_at}"
      message = "#{message}, error: #{log.error}" if log.failure?
      hash[log.job_class] = log.success? ? message : error(message)
    end

    result['Failures total'] = 0
    result['Failures total'] = error(failed_total) if failed_total != 0

    result
  end
end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
marty-14.3.0 lib/marty/diagnostic/scheduled_jobs.rb
marty-14.0.0 lib/marty/diagnostic/scheduled_jobs.rb
marty-13.0.2 lib/marty/diagnostic/scheduled_jobs.rb
marty-11.0.0 lib/marty/diagnostic/scheduled_jobs.rb
marty-10.0.3 lib/marty/diagnostic/scheduled_jobs.rb
marty-10.0.2 lib/marty/diagnostic/scheduled_jobs.rb
marty-10.0.0 lib/marty/diagnostic/scheduled_jobs.rb
marty-9.5.1 lib/marty/diagnostic/scheduled_jobs.rb
marty-9.5.0 lib/marty/diagnostic/scheduled_jobs.rb
marty-9.3.3 lib/marty/diagnostic/scheduled_jobs.rb
marty-9.3.2 lib/marty/diagnostic/scheduled_jobs.rb
marty-9.3.0 lib/marty/diagnostic/scheduled_jobs.rb
marty-8.5.0 lib/marty/diagnostic/scheduled_jobs.rb
marty-8.4.1 lib/marty/diagnostic/scheduled_jobs.rb
marty-8.3.1 lib/marty/diagnostic/scheduled_jobs.rb
marty-8.2.0 lib/marty/diagnostic/scheduled_jobs.rb
marty-8.0.0 lib/marty/diagnostic/scheduled_jobs.rb
marty-6.1.0 lib/marty/diagnostic/scheduled_jobs.rb
marty-5.2.0 other/marty/diagnostic/scheduled_jobs.rb