Class: SpreeCmCommissioner::IdempotencyKeys::PruneJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/spree_cm_commissioner/idempotency_keys/prune_job.rb

Constant Summary collapse

DEFAULT_CUTOFF_DAYS =
3

Instance Method Summary collapse

Methods included from ApplicationJobDecorator

handle_deserialization_error, prepended

Instance Method Details

#perform(cutoff_days = DEFAULT_CUTOFF_DAYS) ⇒ Object



11
12
13
14
15
16
17
# File 'app/jobs/spree_cm_commissioner/idempotency_keys/prune_job.rb', line 11

def perform(cutoff_days = DEFAULT_CUTOFF_DAYS)
  days = [cutoff_days.to_i, 1].max

  SpreeCmCommissioner::IdempotencyKey
    .where(created_at: ...days.days.ago)
    .delete_all
end