Class: CentralMail::DeleteOldClaims

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

Constant Summary collapse

EXPIRATION_TIME =
2.months

Instance Method Summary collapse

Instance Method Details

#performObject



13
14
15
16
17
18
19
20
21
# File 'app/sidekiq/central_mail/delete_old_claims.rb', line 13

def perform
  PensionBurial::TagSentry.tag_sentry

  CentralMailClaim.joins(:central_mail_submission).where.not(
    central_mail_submissions: { state: 'pending' }
  ).where(
    'created_at < ?', EXPIRATION_TIME.ago
  ).find_each(&:destroy!)
end