diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 12:26:25 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 12:26:25 +0000 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /config/settings.rb | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) | |
download | gitlab-ce-a09983ae35713f5a2bbb100981116d31ce99826e.tar.gz |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
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}" |