Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sidekiq-silent-retry

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sidekiq-silent-retry

  • 0.3.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Sidekiq::SilentRetry

Ruby

sidekiq-silent-retry is a middleware for Sidekiq that allows for silent retries of jobs. This gem intercepts exceptions raised during job execution and re-raises under a different exception class, so that tracing services can ignore them. Only the last exception is raised with the original exception.

Instalation

Add this line to your application's Gemfile:

gem 'sidekiq-silent-retry'

And then execute:

$ bundle install

Usage

Configuration

1. Specify the error class for Silent Retry (optional)

You can specify a custom error class for silent retries. This is useful for making error tracing services ignore these errors.

Create an initializer file (e.g., config/initializers/sidekiq_silent_retry.rb) and add the following:

Sidekiq::SilentRetry.silent_retry_error_class = MySilentRetryError
2. Mark jobs for Silent Retry

In your Sidekiq job class, configure the silent_retry option to control silent retries. The silent_retry option can be:

  • false / nil: Disabled (default).
  • true: Always enabled, no matter the error.
  • Some class / Array of classes: Only exceptions of said class(es) will be silently retried.

You can also set warn_after option to start raise warnings after a number of retries instead of only the last one.

class MyJob
  include Sidekiq::Job

  sidekiq_options silent_retry: true

  def perform(*args)
    # Your job logic here
  end
end

class MyJob
  include Sidekiq::Job

  sidekiq_options silent_retry: [CommonError, CommonError2], warn_after: 2

  def perform(*args)
    # Your job logic here
  end
end

Dependencies

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/trusted/sidekiq-silent-retry. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Sidekiq::SilentRetry project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

FAQs

Package last updated on 30 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc