Skip to content

Commit

Permalink
Merge pull request #2003 from trade-tariff/bau-disable-differences-ch…
Browse files Browse the repository at this point in the history
…eck-outside-prod

BAU: Don't run differences check outside production
  • Loading branch information
neilmiddleton authored Oct 22, 2024
2 parents 354c4b2 + 688e008 commit 11b52a1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/workers/differences_report_check_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ class DifferencesReportCheckWorker
sidekiq_options retry: 1, retry_in: 1.hour

def perform
return unless Rails.env.production?

last_log = DifferencesLog.max(:date)
notify_failure if last_log < 7.days.ago
end
Expand Down
1 change: 1 addition & 0 deletions spec/workers/differences_report_check_worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
end

it 'is unhappy if the differences report has not run this week' do
allow(Rails.env).to receive(:production?).and_return(true)
DifferencesLog.create(date: 10.days.ago, key: 'foo', value: 'foo')
worker.perform
expect(SlackNotifierService).to have_received(:call)
Expand Down

0 comments on commit 11b52a1

Please sign in to comment.