Commit c0a92cb8 authored by Olaf Tomalka's avatar Olaf Tomalka

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.
parent e25b48ff
......@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.12.0 (unreleased)
- Add ability to fork to a specific namespace using API. (ritave)
- Cleanup misalignments in Issue list view !6206
- Prune events older than 12 months. @ritave <olaf@tomalka.me>
- Prepend blank line to `Closes` message on merge request linked to issue (lukehowell)
- Prune events older than 12 months.
- Filter tags by name !6121
......
......@@ -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
......@@ -300,7 +300,7 @@ Settings.cron_jobs['remove_expired_group_links_worker'] ||= Settingslogic.new({}
Settings.cron_jobs['remove_expired_group_links_worker']['cron'] ||= '10 0 * * *'
Settings.cron_jobs['remove_expired_group_links_worker']['job_class'] = 'RemoveExpiredGroupLinksWorker'
Settings.cron_jobs['prune_old_events_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['prune_old_events_worker']['cron'] ||= '0 0 * * *'
Settings.cron_jobs['prune_old_events_worker']['cron'] ||= '* */6 * * *'
Settings.cron_jobs['prune_old_events_worker']['job_class'] = 'PruneOldEventsWorker'
#
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment