Skip to content

Commit

Permalink
make it clear @next_time is not set to false
Browse files Browse the repository at this point in the history
as surfaced in discussion at gh-129
  • Loading branch information
jmettraux committed Aug 14, 2014
1 parent 43ebb00 commit 113ff1f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions CREDITS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

== Feedback

- ecin - https://github.com/ecin - set_next_time() ambiguity
- junhanamaki - https://github.com/junhanamaki - #next_time and dst ambiguities
- kreynolds (tossrock) - inspiration for #occurrences
- Matteo - https://github.com/m4ce - dst and cron issue
Expand Down
16 changes: 8 additions & 8 deletions lib/rufus/scheduler/jobs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def initialize(scheduler, original, opts, block)

def trigger(time)

set_next_time(false, time)
set_next_time(time)

return if opts[:overlap] == false && running?

Expand Down Expand Up @@ -272,7 +272,7 @@ def do_trigger(time)

def post_trigger(time)

set_next_time(true, time)
set_next_time(time, true)

callback(:on_post_trigger, time)
end
Expand Down Expand Up @@ -356,7 +356,7 @@ def determine_id

# 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
Expand Down Expand Up @@ -527,12 +527,12 @@ def initialize(scheduler, duration, opts, block)
"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

Expand Down Expand Up @@ -567,12 +567,12 @@ def initialize(scheduler, interval, opts, block)
"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
Expand Down Expand Up @@ -616,7 +616,7 @@ def brute_frequency

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
Expand Down

0 comments on commit 113ff1f

Please sign in to comment.