Skip to content

Commit

Permalink
Show GUID as part of alert message on slow moving UploadSubmission st…
Browse files Browse the repository at this point in the history
…atuses (#12881)
  • Loading branch information
cilestin authored Jun 6, 2023
1 parent bc49d0e commit 959a034
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def summary_notification

start_time = model.metadata['status'][status]['start']
duration = distance_of_time_in_words(Time.now.to_i - start_time)
results += "\n\tStatus \'#{status}\' for #{duration}"
results += "\n\tStatus \'#{status}\' for #{duration} (GUID: #{model.guid})"
end

notify_slack('Status Report (worst offenders over past week)', results)
Expand Down
9 changes: 5 additions & 4 deletions modules/vba_documents/spec/workers/slack_notifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
end

context 'summary notification' do
let(:upload_submission) { VBADocuments::UploadSubmission.create(status: 'received') }

before do
u = VBADocuments::UploadSubmission.create(status: 'received')
u.metadata['status']['received']['start'] = 15.minutes.ago.to_i
u.save!
upload_submission.metadata['status']['received']['start'] = 15.minutes.ago.to_i
upload_submission.save!
end

it 'notifies on every run' do
Expand All @@ -43,7 +44,7 @@
{
class: 'VBADocuments::SlackNotifier',
alert: 'Status Report (worst offenders over past week)',
details: "\n\tStatus 'received' for 15 minutes"
details: "\n\tStatus 'received' for 15 minutes (GUID: #{upload_submission.guid})"
}
)
expect(slack_messenger).to have_received(:notify!).once
Expand Down

0 comments on commit 959a034

Please sign in to comment.