Reputation: 757
So I'm looking into adding some functionality in my app which will allow users to schedule certain tasks. A brief search brought Resque and Resque-Scheduler to my attention. However, I'm wondering if it will let me change scheduled tasks on the fly. From what I've seen, the scheduler only loads from a config file. Is there some way to make this work, or am I pursuing the wrong track?
Upvotes: 0
Views: 1514
Reputation: 1702
You can change the schedule dynamically.
From the repo readme (https://github.com/resque/resque-scheduler)
Dynamic schedules allow for greater flexibility than static schedules as they can be set, unset or changed without having to restart resque-scheduler. You can specify, if the schedule must survive a resque-scheduler restart or not.
[Note that at the time of this writing, the approach of setting "Resque:Scheduler.dynamic = true" in your Rakefile is not working. Instead, use the option of setting an env variable (DYNAMIC_SCHEDULE)]
Upvotes: 0
Reputation: 5962
Not really config
is not the only way to schedule a task in resque
using resque-scheduler
config
is generally used for recurring task something like cron-tab
do in your case
but in your case it wont work here how you can programmatically schedule your task using resque-scheduler
Resque.enqueue_in(5.days, SomeJob) # run a job in 5 days
or
Resque.enqueue_at(5.days.from_now, SomeJob) # run SomeJob at a specific time
You can also remove them if you want
Resque.remove_delayed
You can find completed guide of it in resque-scheduler README
Hope this help
Upvotes: 1