lib/rufus/scheduler/jobs.rb in rufus-scheduler-3.1.10 vs lib/rufus/scheduler/jobs.rb in rufus-scheduler-3.2.0
- old
+ new
@@ -389,11 +389,11 @@
class RepeatJob < Job
attr_reader :paused_at
attr_reader :first_at
- attr_accessor :last_at
+ attr_reader :last_at
attr_accessor :times
def initialize(scheduler, duration, opts, block)
super
@@ -541,12 +541,15 @@
def set_next_time(trigger_time, is_post=false)
return if is_post
+ n = Time.now
+
@next_time =
- if @first_at == nil || @first_at < Time.now
- (trigger_time || Time.now) + @frequency
+ if @first_at == nil || @first_at < n
+ nt = (@next_time || trigger_time || n) + @frequency
+ nt > n ? nt : (trigger_time || n) + @frequency
else
@first_at
end
end