Class: Airbrake::Sidekiq::RetryableJobsFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/airbrake/sidekiq/retryable_jobs_filter.rb

Overview

Filter that can ignore notices from jobs that failed but will be retried by Sidekiq

Since:

  • v7.3.0

Constant Summary collapse

SIDEKIQ_GTE_5_0_0 =

Since:

  • v7.3.0

Gem::Version.new(::Sidekiq::VERSION) >= Gem::Version.new('5.0.0')
SIDEKIQ_GTE_7_0_0 =

Since:

  • v7.3.0

Gem::Version.new(::Sidekiq::VERSION) >= Gem::Version.new('7.0.0')
DEFAULT_MAX_RETRY_ATTEMPTS =

Since:

  • v7.3.0

::Sidekiq::Middleware::Server::RetryJobs::DEFAULT_MAX_RETRY_ATTEMPTS

Instance Method Summary collapse

Constructor Details

#initialize(max_retries: nil) ⇒ RetryableJobsFilter

Returns a new instance of RetryableJobsFilter.

Since:

  • v7.3.0



21
22
23
# File 'lib/airbrake/sidekiq/retryable_jobs_filter.rb', line 21

def initialize(max_retries: nil)
  @retries_before_notify = max_retries
end

Instance Method Details

#call(notice) ⇒ Object

Since:

  • v7.3.0



25
26
27
28
29
# File 'lib/airbrake/sidekiq/retryable_jobs_filter.rb', line 25

def call(notice)
  job = notice[:params][:job]

  notice.ignore! if retryable?(job)
end