resque/resque-scheduler — pull request #314 by bugant (2013-12-12 23:12:30+00:00)
Title: Persist dynamic schedules

This PR is meant to fix the issue raised in #269: whenever the schedule is re-read and reloaded, dynamic schedules disappear.

The idea to fix this is to make Resque#clean_schedules respect `persist` config, i.e., if a schedule is set to be persisted, it won't be cleaned. In order to make a job persistent, just set its `persist` config to `true`:

name = 'send_emails'
config = {}
config[:class] = 'SendEmail'
config[:args] = 'POC email subject'
config[:every] = ['1h', {first_in: 5.minutes}]
config[:persist] = true
Resque.set_schedule(name, config)

By default, a schedule will not be persisted.