Class: DecisionReview::DeleteSavedClaimRecordsJob

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Job
Defined in:
app/sidekiq/decision_review/delete_saved_claim_records_job.rb

Constant Summary collapse

STATSD_KEY_PREFIX =
'worker.decision_review.delete_saved_claim_records'

Instance Method Summary collapse

Instance Method Details

#enabled?Boolean (private)

Returns:

  • (Boolean)


28
29
30
# File 'app/sidekiq/decision_review/delete_saved_claim_records_job.rb', line 28

def enabled?
  Flipper.enabled? :decision_review_delete_saved_claims_job_enabled
end

#performObject



14
15
16
17
18
19
20
21
22
23
24
# File 'app/sidekiq/decision_review/delete_saved_claim_records_job.rb', line 14

def perform
  return unless enabled?

  deleted_records = ::SavedClaim.where(delete_date: ..DateTime.now).destroy_all
  StatsD.increment("#{STATSD_KEY_PREFIX}.count", deleted_records.size)

  nil
rescue => e
  StatsD.increment("#{STATSD_KEY_PREFIX}.error")
  Rails.logger.error('DecisionReview::DeleteSavedClaimRecordsJob perform exception', e.message)
end