From a09983ae35713f5a2bbb100981116d31ce99826e Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 20 Jul 2020 12:26:25 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-2-stable-ee --- config/settings.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'config/settings.rb') 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}" -- cgit v1.2.1