Class: VRE::Submit1900Job

Inherits:
Object
  • Object
show all
Includes:
SentryLogging, Sidekiq::Job
Defined in:
app/sidekiq/vre/submit1900_job.rb

Constant Summary collapse

STATSD_KEY_PREFIX =
'worker.vre.submit_1900_job'
RETRY =
16

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata

Class Method Details

.trigger_failure_events(msg) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'app/sidekiq/vre/submit1900_job.rb', line 30

def self.trigger_failure_events(msg)
  monitor = VRE::Monitor.new
  claim_id, encrypted_user = msg['args']
  claim = SavedClaim.find(claim_id)
  user = encrypted_user.present? ? OpenStruct.new(JSON.parse(KmsEncrypted::Box.new.decrypt(encrypted_user))) : nil
  email = claim.parsed_form['email'] || user.try(:va_profile_email)
  monitor.track_submission_exhaustion(msg, email)
  claim.send_failure_email(email) if claim.present?
end

Instance Method Details

#perform(claim_id, encrypted_user) ⇒ Object



21
22
23
24
25
26
27
28
# File 'app/sidekiq/vre/submit1900_job.rb', line 21

def perform(claim_id, encrypted_user)
  claim = SavedClaim::VeteranReadinessEmploymentClaim.find claim_id
  user = OpenStruct.new(JSON.parse(KmsEncrypted::Box.new.decrypt(encrypted_user)))
  claim.send_to_vre(user)
rescue => e
  Rails.logger.warn("VRE::Submit1900Job failed, retrying...: #{e.message}")
  raise
end