lib/rufus/scheduler/jobs.rb in rufus-scheduler-3.0.8 vs lib/rufus/scheduler/jobs.rb in rufus-scheduler-3.0.9
- old
+ new
@@ -115,20 +115,21 @@
alias job_id id
def trigger(time)
- set_next_time(false, time)
+ set_next_time(time)
- return if opts[:overlap] == false && running?
-
- r =
+ return if (
+ opts[:overlap] == false &&
+ running?
+ )
+ return if (
callback(:confirm_lock, time) &&
callback(:on_pre_trigger, time)
+ ) == false
- return if r == false
-
@count += 1
if opts[:blocking]
do_trigger(time)
else
@@ -270,11 +271,11 @@
Thread.current[:rufus_scheduler_timeout] = nil
end
def post_trigger(time)
- set_next_time(true, time)
+ set_next_time(time, true)
callback(:on_post_trigger, time)
end
def start_work_thread
@@ -354,11 +355,11 @@
].map(&:to_s).join('_')
end
# There is no next_time for one time jobs, hence the false.
#
- def set_next_time(is_post, trigger_time)
+ def set_next_time(trigger_time, is_post=false)
@next_time = is_post ? nil : false
end
end
@@ -525,16 +526,16 @@
raise ArgumentError.new(
"cannot schedule #{self.class} with a frequency " +
"of #{@frequency.inspect} (#{@original.inspect})"
) if @frequency <= 0
- set_next_time(false, nil)
+ set_next_time(nil)
end
protected
- def set_next_time(is_post, trigger_time)
+ def set_next_time(trigger_time, is_post=false)
return if is_post
@next_time =
if trigger_time
@@ -565,16 +566,16 @@
raise ArgumentError.new(
"cannot schedule #{self.class} with an interval " +
"of #{@interval.inspect} (#{@original.inspect})"
) if @interval <= 0
- set_next_time(false, nil)
+ set_next_time(nil)
end
protected
- def set_next_time(is_post, trigger_time)
+ def set_next_time(trigger_time, is_post=false)
@next_time =
if is_post
Time.now + @interval
elsif trigger_time.nil?
@@ -614,10 +615,10 @@
@cron_line.brute_frequency
end
protected
- def set_next_time(is_post, trigger_time)
+ def set_next_time(trigger_time, is_post=false)
@next_time = @cron_line.next_time
end
def next_time_from(time)