Skip to content

Commit

Permalink
Set last_checked to time before 1y, so new queries will run on first …
Browse files Browse the repository at this point in the history
…schedule
  • Loading branch information
var77 committed May 11, 2024
1 parent c2a59e3 commit eadf709
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion model/lantern/lantern_doctor_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def response_type
end

def should_run?
CronParser.new(schedule).next(last_checked || Time.new - 61) <= Time.new
CronParser.new(schedule).next(last_checked || Time.new - 365 * 24 * 60 * 60) <= Time.new
end

def is_system?
Expand Down
1 change: 1 addition & 0 deletions spec/model/lantern/lantern_doctor_query_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
min = Time.new.min
modified_min = (min == 59) ? 0 : min + 1

expect(lantern_doctor_query).to receive(:last_checked).and_return(Time.new)
expect(lantern_doctor_query).to receive(:schedule).and_return("#{modified_min} * * * *").at_least(:once)
expect(lantern_doctor_query.should_run?).to be(false)
end
Expand Down

0 comments on commit eadf709

Please sign in to comment.