From f7f7c3016252a09acd68c822c8950848e313ce8a Mon Sep 17 00:00:00 2001 From: Ben Kochie Date: Wed, 17 Jul 2019 14:50:37 +0200 Subject: Update usage ping cron behavior * Splay the start by sleeping up to one minute. * Adjust sideikiq retries to try up to approximately three hours. * Randomize the minute fully within the hour. * Psudo-randomize the day of the week based on the instance UUID. --- app/workers/gitlab_usage_ping_worker.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/workers') diff --git a/app/workers/gitlab_usage_ping_worker.rb b/app/workers/gitlab_usage_ping_worker.rb index b75e724ca98..a5e22f88a3b 100644 --- a/app/workers/gitlab_usage_ping_worker.rb +++ b/app/workers/gitlab_usage_ping_worker.rb @@ -6,10 +6,16 @@ class GitlabUsagePingWorker include ApplicationWorker include CronjobQueue + # Retry for up to approximately three hours then give up. + sidekiq_options retry: 10, dead: false + def perform # Multiple Sidekiq workers could run this. We should only do this at most once a day. return unless try_obtain_lease + # Splay the request over a minute to avoid thundering herd problems. + sleep(rand(0.0..60.0).round(3)) + SubmitUsagePingService.new.execute end -- cgit v1.2.3