
Security News
Rspack Introduces Rslint, a TypeScript-First Linter Written in Go
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.
tech-angels-resque-throttle
Advanced tools
Resque Throttle is a plugin for the Resque queueing system (http://github.com/defunkt/resque). It adds a ThrottledJob class that will limit the amount of times it can be enqueued per class.
The job you wish to throttle should inherit from the Resque::ThrottledJob class.
In your class, add the can_run_every in which the job should be throttled. Example:
class MyThrottledJob < Resque::ThrottledJob
throttle :can_run_every => 24.hours
#rest of your class here
end
By default, the key which identifies the job is simply the class name. This "identifier" is stored in a redis key with a TTL equal to that of the can_run_every. Thus the default behavior is a single Job class inheriting from Resque::ThrottledJob can only run every 30 minutes.
If you'd like to override that to be more granular, you can do that in the identifier class method by returning a string. For example, if you want the job to be limited to once a day per account, do something like the following:
class MyThrottledJob < Resque::ThrottledJob
throttle :can_run_every => 24.hours
def self.identifier(*args)
account_id = *args
"account_id:#{account_id}"
end
#rest of your class here
end
The *args passed to identifier are the same arguments that are passed to perform.
When a job is throttled, it will raise a ThrottledError and the job will not be enqueued.
Once you've made your commits:
git checkout -b my_branch
git push origin my_branch
Scott J. Tamosunas :: tamosunas@gmail.com :: @scotttam
Copyright (c) 2010 Zendesk. See LICENSE for details.
FAQs
Unknown package
We found that tech-angels-resque-throttle demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Rspack launches Rslint, a fast TypeScript-first linter built on typescript-go, joining in on the trend of toolchains creating their own linters.
Security News
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.