Class: EVSS::DisabilityCompensationForm::SubmitForm8940
- Extended by:
- Logging::ThirdPartyTransaction::MethodWrapper
- Defined in:
- app/sidekiq/evss/disability_compensation_form/submit_form8940.rb
Constant Summary collapse
- STATSD_KEY_PREFIX =
'worker.evss.submit_form8940'
- RETRY =
Sidekiq has built in exponential back-off functionality for retries A max retry attempt of 16 will result in a run time of ~48 hours This job is invoked from 526 background job
16
Instance Attribute Summary collapse
-
#submission_id ⇒ Object
Returns the value of attribute submission_id.
Instance Method Summary collapse
- #client ⇒ Object private
- #document ⇒ Object private
- #get_docs(submission_id) ⇒ Object
-
#perform(submission_id) ⇒ Object
Performs an asynchronous job for generating and submitting 8940 PDF documents to VBMS.
- #upload_to_vbms ⇒ Object private
Methods included from Logging::ThirdPartyTransaction::MethodWrapper
Methods inherited from Job
Methods included from Sidekiq::Form526JobStatusTracker::JobTracker
#error_message, #job_success, #job_try, #klass, #log_error, #log_info, #metrics, #non_retryable_error_handler, #retryable_error_handler, #update_background_job_errors, #upsert_job_status, #with_tracking
Methods included from Sidekiq::Form526JobStatusTracker::BackupSubmission
#send_backup_submission_if_enabled
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata
Instance Attribute Details
#submission_id ⇒ Object
Returns the value of attribute submission_id.
64 65 66 |
# File 'app/sidekiq/evss/disability_compensation_form/submit_form8940.rb', line 64 def submission_id @submission_id end |
Instance Method Details
#client ⇒ Object (private)
115 116 117 118 119 120 121 |
# File 'app/sidekiq/evss/disability_compensation_form/submit_form8940.rb', line 115 def client @client ||= if Flipper.enabled?(:disability_compensation_lighthouse_document_service_provider) # TODO: create client from lighthouse document service else EVSS::DocumentsService.new(submission.auth_headers) end end |
#document ⇒ Object (private)
104 105 106 |
# File 'app/sidekiq/evss/disability_compensation_form/submit_form8940.rb', line 104 def document @document ||= EVSS::DisabilityCompensationForm::Form8940Document.new(submission) end |
#get_docs(submission_id) ⇒ Object
76 77 78 79 |
# File 'app/sidekiq/evss/disability_compensation_form/submit_form8940.rb', line 76 def get_docs(submission_id) @submission_id = submission_id { type: '21-8940', file: EVSS::DisabilityCompensationForm::Form8940Document.new(submission) } end |
#perform(submission_id) ⇒ Object
Performs an asynchronous job for generating and submitting 8940 PDF documents to VBMS
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'app/sidekiq/evss/disability_compensation_form/submit_form8940.rb', line 85 def perform(submission_id) @submission_id = submission_id Sentry.(source: '526EZ-all-claims') super(submission_id) with_tracking('Form8940 Submission', submission.saved_claim_id, submission_id) do upload_to_vbms end rescue => e # Cannot move job straight to dead queue dynamically within an executing job # raising error for all the exceptions as sidekiq will then move into dead queue # after all retries are exhausted retryable_error_handler(e) raise e end |
#upload_to_vbms ⇒ Object (private)
108 109 110 111 112 113 |
# File 'app/sidekiq/evss/disability_compensation_form/submit_form8940.rb', line 108 def upload_to_vbms client.upload(document.file_body, document.data) ensure # Delete the temporary PDF file File.delete(document.pdf_path) if document.pdf_path.present? end |