Delayed Job Memento
Delayed Jobs can be sentimental, save them as mementos so you don't have to forget.
Also, set quotas for delayed jobs.
Installation
Add this line to your Gemfile:
gem 'delayed_job_memento'
and run bundle
or without bundler:
$ gem install delayed_job_memento
####Then
Create migration for mementos:
$ rails g delayed_job_memento:install
$ rake db:migrate
Usage
####You probably shouldn't hold onto mementos forever:
# config/initializers
Delayed::Memento.expiration = 1.week
## keep quotas in mind, see below
####To set Quotas:
# config/initializers
Delayed::Quota.new(queue: 'cat emails', interval: 1.day, size: 100) # Don't send more than 100 cat emails per day
...
## Don't let any of your quota intervals exceed memento expiration time or that quota wont work
When a Quota is reached its queue is rebalanced so that remaining queue jobs run at the end of the quotas current lifetime.
####Get mementos
Delayed::Memento.all
Note
Only works with ActiveRecord as your delayed job backend.
TODO
- Tests
- More Backends
- More things to do with Mementos
Contributing
- Fork it ( http://github.com//delayed_job_memento/fork )
- 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 new Pull Request
LICENSE