Socket
Book a DemoInstallSign in
Socket

sidekiq-uniq

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sidekiq-uniq

0.8.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

Sidekiq Uniq

This is an extension for Sidekiq that by default doesn't allow a job to be enqueued if it's already in the queue or being processed.

It does so by keeping in Redis the information about each job's status, where a job is identified by its class and arguments. Possible statuses are: enqueued, running and completed. In case a job fails and is unable to release the lock, all status keys expire (by using Redis' EXPIRE command) after some time (which can be defined by Sidekiq::Uniq::Status.expiration = <time in seconds>).

Useful to use with recurring jobs, like the ones created by sidekiq-cron.

When such thing is not used, if you have tons of jobs to be processed, and the time to process the queue is greater than the interval of the jobs, you can end up with a huge queue on Redis, leading to memory usage problems (protip).

Installation

Add this line to your application's Gemfile:

gem 'sidekiq-uniq'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sidekiq-uniq

Usage

If you want the default behavior (which is to not allow a job to be enqueued if it's already in the queue), nothing is needed.

If you want to avoid the default behavior for a given job, just add sidekiq_options unique: false to it.

Expiration time can be defined like this: Sidekiq::Uniq::Status.expiration = <time in seconds>. The dafault value is 30 minutes.

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create a new Pull Request

FAQs

Package last updated on 10 Dec 2015

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.