Class: Sidekiq::Form526BackupSubmissionProcess::Submit
- Inherits:
-
Object
- Object
- Sidekiq::Form526BackupSubmissionProcess::Submit
show all
- Extended by:
- ActiveSupport::Concern
- Includes:
- SentryLogging, Job
- Defined in:
- lib/sidekiq/form526_backup_submission_process/submit.rb
Constant Summary
collapse
- STATSD_KEY_PREFIX =
'worker.evss.form526_backup_submission_process'
Instance Method Summary
collapse
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata
Instance Method Details
#error_hash_for_job_status(e) ⇒ Object
107
108
109
110
111
112
113
114
115
116
117
|
# File 'lib/sidekiq/form526_backup_submission_process/submit.rb', line 107
def error_hash_for_job_status(e)
timestamp = Time.zone.now
{
"#{timestamp.to_i}": {
caller_method: __method__.to_s,
error_class: e.class.to_s,
error_message: e.message,
timestamp:
}
}
end
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/sidekiq/form526_backup_submission_process/submit.rb', line 76
def perform(form526_submission_id)
return unless Settings.form526_backup.enabled
Form526Submission.find(form526_submission_id).benefits_intake_api!
job_status = Form526JobStatus.find_or_initialize_by(job_id: jid)
job_status.assign_attributes(form526_submission_id:,
job_class: 'BackupSubmission',
status: 'pending')
job_status.save!
Processor.new(form526_submission_id).process!
job_status.update(status: Form526JobStatus::STATUS[:success])
rescue => e
::Rails.logger.warn(
message: 'Form 526 backup submission failure. retrying...',
error_message: e.message,
backtrace: e.backtrace,
submission_id: form526_submission_id
)
update_job_status_bgjob_errors(job_status, e)
raise e
end
|
#update_job_status_bgjob_errors(job_status, e) ⇒ Object
101
102
103
104
105
|
# File 'lib/sidekiq/form526_backup_submission_process/submit.rb', line 101
def update_job_status_bgjob_errors(job_status, e)
bgjob_errors = job_status.bgjob_errors || {}
bgjob_errors.merge!(error_hash_for_job_status(e))
job_status.update(status: Form526JobStatus::STATUS[:retryable_error], bgjob_errors:)
end
|