Sha256: f90d9b10610b23279db20fb762a8f323af14d59bb63d0e9d7e848c04dd821acd
Contents?: true
Size: 1.13 KB
Versions: 22
Compression:
Stored size: 1.13 KB
Contents
module Cron # # Automatically update Product Version Lifecycle State to EOL If it is past it's EOL date # Runs Daily # class TrimFailedDelayedJobs < TrimCollection # # Return the failed collection # def collection Delayed::Backend::Mongoid::Job.where(:failed_at.exists => true) end def archive?(job) if 'Delayed::PerformableMethod'.eql?(job.name) data = { object: job.failed_object.inspect, method: job.failed_method_name, args: job.failed_args, failed_at: job.failed_at, attempts: job.attempts, locked_by: job.locked_by } SlackNotification.say(data, template: :failed_delayed_job) true else false end rescue StandardError => error log_error "Unable to determine if we should archive job: #{job}", error false end # # If the slack API is not present, don't delete jobs or we wont know about it. # def self.valid_environment? SystemConfiguration.slack_api_url.present? && Delayed::Backend::Mongoid::Job.count.positive? end end end
Version data entries
22 entries across 22 versions & 1 rubygems