Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions config/initializers/job_configurations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
cron_24h_1am = '0 1 * * *' # 1am UTC is 8pm EST/9pm EDT
gpo_cron_24h = '0 10 * * *' # 10am UTC is 5am EST/6am EDT
cron_every_monday = 'every Monday at 0:00 UTC' # equivalent to '0 0 * * 1'
cron_every_monday_1am = 'every Monday at 1:00 UTC' # equivalent to '0 1 * * 1'
cron_every_monday_2am = 'every Monday at 2:00 UTC' # equivalent to '0 2 * * 1'

if defined?(Rails::Console)
Rails.logger.info 'job_configurations: console detected, skipping schedule'
Expand Down Expand Up @@ -226,13 +228,13 @@
# Previous week's drop of report
weekly_drop_off_report: {
class: 'Reports::DropOffReport',
cron: cron_every_monday,
cron: cron_every_monday_1am,
args: -> { [Time.zone.yesterday.end_of_day] },
},
# Previous week's protocols report
weekly_protocols_report: {
class: 'Reports::ProtocolsReport',
cron: cron_every_monday,
cron: cron_every_monday_2am,
args: -> { [Time.zone.yesterday.end_of_day] },
},
}.compact
Expand Down
8 changes: 2 additions & 6 deletions spec/config/initializers/job_configurations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,9 @@

now = Time.zone.now
next_time = Fugit.parse(report[:cron]).next_time
expect(next_time.utc > now.utc.end_of_week).
to be(true), "Expected #{job_name} to next run after the end of this week"
expect(next_time.utc).
to be_within(1).of(now.utc.end_of_week), <<~EOS.squish
Expected #{job_name} to run soon after the end of week,
so CONUS 'yesterday' and UTC 'yesterday' will never be different
EOS
to be_within(2.hours).of(now.utc.end_of_week)
expect(next_time.utc).to be > now.utc.end_of_week
end
end
end
Expand Down