diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-08 18:09:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-08 18:09:24 +0300 |
commit | 833d57e60da633435d845a7867e46e6092c46520 (patch) | |
tree | 35676d3a0da36ef28b67cadb06af474b6c8f5b85 /config/settings.rb | |
parent | c52b72f5772d52e9fc85bd9f4e8b8497a6278c37 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'config/settings.rb')
-rw-r--r-- | config/settings.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/config/settings.rb b/config/settings.rb index 99f1b85202e..c681fa32491 100644 --- a/config/settings.rb +++ b/config/settings.rb @@ -184,14 +184,15 @@ class Settings < Settingslogic URI.parse(url_without_path).host end - # Runs at a random time of day on a consistent day of the week based on + # Runs at a consistent random time of day on a day of the week based on # the instance UUID. This is to balance the load on the service receiving # these pings. The sidekiq job handles temporary http failures. def cron_for_usage_ping - hour = rand(24) - minute = rand(60) # Set a default UUID for the case when the UUID hasn't been initialized. uuid = Gitlab::CurrentSettings.uuid || 'uuid-not-set' + + minute = Digest::MD5.hexdigest(uuid + 'minute').to_i(16) % 60 + hour = Digest::MD5.hexdigest(uuid + 'hour').to_i(16) % 24 day_of_week = Digest::MD5.hexdigest(uuid).to_i(16) % 7 "#{minute} #{hour} * * #{day_of_week}" |