Class: Lighthouse::PollForm526PdfStatus

Inherits:
Object
  • Object
show all
Defined in:
app/sidekiq/lighthouse/poll_form526_pdf.rb

Class Method Summary collapse

Class Method Details

.update_job_status(form_job_status:, message:, error_class:, error_message:) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/sidekiq/lighthouse/poll_form526_pdf.rb', line 14

def self.update_job_status(form_job_status:, message:, error_class:, error_message:)
  timestamp = Time.now.utc
  form526_submission_id = form_job_status.form526_submission_id
  job_id = form_job_status.job_id
  bgjob_errors = form_job_status.bgjob_errors || {}
  new_error = {
    "#{timestamp.to_i}": {
      caller_method: __method__.to_s,
      error_class:,
      error_message:,
      timestamp:,
      form526_submission_id:
    }
  }

  form_job_status.update(
    status: Form526JobStatus::STATUS[:pdf_not_found],
    bgjob_errors: bgjob_errors.merge(new_error),
    error_class:,
    error_message: message
  )

  ::Rails.logger.warn(
    message,
    { job_id:, error_class:, error_message:, timestamp:, form526_submission_id: }
  )
end