diff options
author | Olaf Tomalka <olaf.tomalka@gmail.com> | 2016-09-05 22:57:56 +0200 |
---|---|---|
committer | Olaf Tomalka <olaf.tomalka@gmail.com> | 2016-09-07 19:41:25 +0200 |
commit | c0a92cb801528f00d1317b01fd8a94274552c166 (patch) | |
tree | 22275ef42f6f897cb684ab67b92124943f703841 /app/workers | |
parent | e25b48ffcf1f7ef31df8d6c3366674e7f5c29893 (diff) | |
download | gitlab-ce-c0a92cb801528f00d1317b01fd8a94274552c166.tar.gz |
Limited amount of pruned Event rows per run
Old deployments of Gitlab might have a big number of old events to be
deleted. Such numbers cause the worker to timeout.
I've limited the amount of rows that should be destroyed at once to
10000, and increased how often pruning shall take place to 4 times a
day.
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/prune_old_events_worker.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/workers/prune_old_events_worker.rb b/app/workers/prune_old_events_worker.rb index a0182fc67d0..d75083f9ab1 100644 --- a/app/workers/prune_old_events_worker.rb +++ b/app/workers/prune_old_events_worker.rb @@ -3,6 +3,6 @@ class PruneOldEventsWorker def perform # Contribution calendar shows maximum 12 months of events - Event.where('created_at < ?', (12.months + 1.day).ago).destroy_all + Event.delete(Event.unscoped.where('created_at < ?', (12.months + 1.day).ago).limit(10_000).pluck(:id)) end end |