diff options
Diffstat (limited to 'app/workers/prune_old_events_worker.rb')
-rw-r--r-- | app/workers/prune_old_events_worker.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/app/workers/prune_old_events_worker.rb b/app/workers/prune_old_events_worker.rb index c8dfb2ade0a..927c21d9c53 100644 --- a/app/workers/prune_old_events_worker.rb +++ b/app/workers/prune_old_events_worker.rb @@ -15,9 +15,13 @@ class PruneOldEventsWorker # rubocop:disable Scalability/IdempotentWorker DELETE_LIMIT = 10_000 def perform - # Contribution calendar shows maximum 12 months of events, we retain 3 years for data integrity. - cutoff_date = (3.years + 1.day).ago + if Feature.enabled?(:ops_prune_old_events, type: :ops) + # Contribution calendar shows maximum 12 months of events, we retain 3 years for data integrity. + cutoff_date = (3.years + 1.day).ago - Event.unscoped.created_before(cutoff_date).delete_with_limit(DELETE_LIMIT) + Event.unscoped.created_before(cutoff_date).delete_with_limit(DELETE_LIMIT) + else + Gitlab::AppLogger.info(":ops_prune_old_events is disabled, skipping.") + end end end |