Search code examples
ruby-on-railsrubyrubygemsrufus-scheduler

How do you run a task biweekly from a particular date using rufus-scheduler


I'm trying to run a task every two weeks starting today, but in my tests, its seems that when rufus scheduler starts up, it tries to run the task however many times it has 'missed' until it catches up.

So for example, if I try something like this

require 'chronic'
scheduler = Rufus::Scheduler.start_new

scheduler.every '20m', :first_at => Chronic.parse('February 7 2011 at 5pm') do
    User.send_emails if Rails.env.eql?('development')
end

if the time is 5:57 ... scheduler will try to send the emails twice to make up for the times it 'missed' at 5:20 and 5:40 ... make sense? Is there a way to get it to send as normal without trying to 'catch up'?


Solution

  • Answered at http://groups.google.com/group/rufus-ruby/browse_thread/thread/e0aa06d29ae4ef69