Sha256: 0cda85ece97f568b201eec065e84be52b167f027ddfe25dcfadccb3fa3ddbaf3
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
module Airbrake module Sidekiq ## # Filter that can ignore notices from jobs that failed but will be retried # by Sidekiq # @since v7.3.0 class RetryableJobsFilter if Gem::Version.new(::Sidekiq::VERSION) < Gem::Version.new('5.0.0') require 'sidekiq/middleware/server/retry_jobs' DEFAULT_MAX_RETRY_ATTEMPTS = \ ::Sidekiq::Middleware::Server::RetryJobs::DEFAULT_MAX_RETRY_ATTEMPTS else require 'sidekiq/job_retry' DEFAULT_MAX_RETRY_ATTEMPTS = ::Sidekiq::JobRetry::DEFAULT_MAX_RETRY_ATTEMPTS end def call(notice) job = notice[:params][:job] notice.ignore! if retryable?(job) end private def retryable?(job) return false unless job && job['retry'] max_attempts = max_attempts_for(job) job['retry_count'] < max_attempts end def max_attempts_for(job) if job['retry'].is_a?(Integer) job['retry'] else max_retries end end def max_retries @max_retries ||= ::Sidekiq.options[:max_retries] || DEFAULT_MAX_RETRY_ATTEMPTS end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
airbrake-7.3.0 | lib/airbrake/sidekiq/retryable_jobs_filter.rb |