Delayed Job Memento Gem Version

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

  1. Tests
  2. More Backends
  3. More things to do with Mementos

Contributing

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

LICENSE