lib/rufus/sc/jobs.rb in rufus-scheduler-2.0.8 vs lib/rufus/sc/jobs.rb in rufus-scheduler-2.0.9

- old
+ new

@@ -253,11 +253,13 @@ # The frequency, in seconds, of this EveryJob # attr_reader :frequency def initialize(scheduler, t, params, &block) + super + determine_frequency determine_at end # Triggers the job (and reschedules it). @@ -282,20 +284,26 @@ return unless @frequency @last = @at # the first time, @last will be nil + now = Time.now.to_f + @at = if @last @last + @frequency else if fi = @params[:first_in] - Time.now.to_f + Rufus.duration_to_f(fi) + now + Rufus.duration_to_f(fi) elsif fa = @params[:first_at] Rufus.at_to_f(fa) else - Time.now.to_f + @frequency + now + @frequency end end + + while @at < now do + @at += @frequency + end if @params[:discard_past] end # It's an every job, have to schedule next time it occurs... # def schedule_next