summaryrefslogtreecommitdiff
path: root/app/workers
diff options
context:
space:
mode:
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/prune_old_events_worker.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/app/workers/prune_old_events_worker.rb b/app/workers/prune_old_events_worker.rb
index d44ad0d8030..dc4b7670131 100644
--- a/app/workers/prune_old_events_worker.rb
+++ b/app/workers/prune_old_events_worker.rb
@@ -6,14 +6,13 @@ class PruneOldEventsWorker
# rubocop: disable CodeReuse/ActiveRecord
def perform
- # Contribution calendar shows maximum 12 months of events.
- # Double nested query is used because MySQL doesn't allow DELETE subqueries
- # on the same table.
+ # Contribution calendar shows maximum 12 months of events, we retain 2 years for data integrity.
+ # Double nested query is used because MySQL doesn't allow DELETE subqueries on the same table.
Event.unscoped.where(
'(id IN (SELECT id FROM (?) ids_to_remove))',
Event.unscoped.where(
'created_at < ?',
- (12.months + 1.day).ago)
+ (2.years + 1.day).ago)
.select(:id)
.limit(10_000))
.delete_all