New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

delayed_job_unique

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

delayed_job_unique

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Delayed Job Unique

Delayed Job Unique is a Ruby gem that provides an extension to delayed_job_active_record for handling unique jobs in the queue.

Installation

$ bundle add delayed_job_unique

Or add the following line to your application's Gemfile:

gem 'delayed_job_unique'

And then execute:

$ bundle install

Usage

The gem provides a Delayed::Job::enqueue_once class method which will use the unique_key of your job to check for other not failed jobs enqueued under the same key. This provides a simple yet flexible mechanism to finely control the concurrency on each Job class.

If the job was already enqueued it will return false, otherwise it will return the enqueued job instance.

Example

class MyUniqueJob
  def perform
    # Your job logic here
  end

  def unique_key
    # Return a unique key for the job (String)
  end
end

# Enqueue the job only if it's not already in the queue
if Delayed::Job.enqueue_once(MyUniqueJob.new)
  # job enqueued
else
  # job was already enqueued 
end

Development

git clone https://github.com/sinaptia/delayed_job_unique.git
cd delayed_job_uniq
bundle install

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b feature/my-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin feature/my-feature)
  5. Create a new Pull Request

FAQs

Package last updated on 07 Feb 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