diff options
author | Sean McGivern <sean@gitlab.com> | 2017-04-05 13:19:59 +0100 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-04-14 15:20:55 +0200 |
commit | ebd5e9b4549ebc80155a5a8f139efdb40b6f8b12 (patch) | |
tree | 84d7f3066f0dbf7022bc0ec58cb3ab235006715a /config/initializers | |
parent | c3bb21ff800699bed829a30c75fa81fd0d4dab8d (diff) | |
download | gitlab-ce-ebd5e9b4549ebc80155a5a8f139efdb40b6f8b12.tar.gz |
Port 'Add EE usage ping' to CE
CE port of https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/557
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/1_settings.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 4c9d829aa9f..c19ccbb8fd8 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -110,6 +110,14 @@ class Settings < Settingslogic URI.parse(url_without_path).host end + + # Random cron time every Sunday to load balance usage pings + def cron_random_weekly_time + hour = rand(24) + minute = rand(60) + + "#{minute} #{hour} * * 0" + end end end @@ -355,6 +363,9 @@ Settings.cron_jobs['remove_unreferenced_lfs_objects_worker']['job_class'] = 'Rem Settings.cron_jobs['stuck_import_jobs_worker'] ||= Settingslogic.new({}) Settings.cron_jobs['stuck_import_jobs_worker']['cron'] ||= '15 * * * *' Settings.cron_jobs['stuck_import_jobs_worker']['job_class'] = 'StuckImportJobsWorker' +Settings.cron_jobs['gitlab_usage_ping_worker'] ||= Settingslogic.new({}) +Settings.cron_jobs['gitlab_usage_ping_worker']['cron'] ||= Settings.send(:cron_random_weekly_time) +Settings.cron_jobs['gitlab_usage_ping_worker']['job_class'] = 'GitlabUsagePingWorker' # # GitLab Shell |