CheckProcessor: restrict scope to "auto" checks

This commit is contained in:
Colin Darie 2018-08-29 17:46:04 +02:00
parent 6ccddc6afc
commit 7a7ef4407b
No known key found for this signature in database
GPG Key ID: 4FB865FDBCA4BCC4
2 changed files with 11 additions and 0 deletions

View File

@ -54,6 +54,7 @@ module CheckProcessor
def base_scope
Check
.active
.auto
.where("last_run_at IS NULL OR last_run_at < DATE_SUB(NOW(), INTERVAL 12 HOUR)")
end

View File

@ -108,6 +108,16 @@ class CheckProcessorTest < ActiveSupport::TestCase
assert_not_includes checks, c2
end
test "resolvers does not include manual checks" do
c1 = create(:check, :expires_next_week)
c2 = create(:check, :expires_next_week, domain: "fff.wxyz")
checks = @processor.resolve_expire_short_term
assert_includes checks, c1
assert_not_includes checks, c2
end
test "#sync_dates respects the interval configuration between sends" do
create_list(:check, 3, :expires_next_week)