class Rufus::Scheduler
def schedule_every (freq, params={}, &block)
have had been triggered after two days).
(without setting a :first_in (or :first_at), our example schedule would
end
# schedule something every two days, start in 5 hours...
scheduler.schedule_every "2d", :first_in => "5h" do
accepted.
Since rufus-scheduler 1.0.2, the params :first_at and :first_in are
end
# won't get rescheduled in case of exception
do_some_prone_to_error_stuff()
scheduler.schedule_every "500", :try_again => false do
want the job to be rescheduled, set the parameter :try_again to false.
In case of exception in the job, it will be rescheduled. If you don't
the job.
This method returns a job identifier which can be used to unschedule()
before the time specified in 'freq'.
Schedules a job in a loop. After an execution, it will not execute
def schedule_every (freq, params={}, &block) params = prepare_params(params) params[:every] = freq first_at = params[:first_at] first_in = params[:first_in] #params[:delayed] = true if first_at or first_in first_at = if first_at at_to_f(first_at) elsif first_in Time.now.to_f + Rufus.duration_to_f(first_in) else Time.now.to_f + Rufus.duration_to_f(freq) # not triggering immediately end do_schedule_at(first_at, params, &block) end