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

resque-filter

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resque-filter

  • 0.5.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

A resque plugin that allows jobs to execute only if a filter is true, re-queueing otherwise. For example, one can author jobs that are filter-aware so that they can be scheduled with resque-scheduler to run on specific hosts.

Authored against Resque 1.20.0, so it at least works with that - try running the tests if you use a different version of resque

Build Status

Usage:

Install the gem, then define a worker with a filter method. If that method returns true, the job will run, otherwise it will get re-enqueued.

class MyFilteredWorker

  def self.perform(*args)
    puts "I ran"
  end
  
  def self.filter(*args)
    return `hostname`.chomp == args.first
  end
  
end

You can also configure an alternate queue management strategy like so:

Resque::Plugins::Filter::JobFilter.configure do |config|
  # The queue strategy to use when filtering job:
  #   :simple - pops, checks filter, pushes if not runnable
  #   :optimistic - peeks, checks filter, pops if runnable (not distributed client safe)
  config.strategy = :simple
end

Contributors:

Matt Conway ( https://github.com/wr0ngway )

FAQs

Package last updated on 27 Apr 2012

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