diff options
author | Ben Kochie <bjk@gitlab.com> | 2019-07-17 15:50:37 +0300 |
---|---|---|
committer | Ben Kochie <bjk@gitlab.com> | 2019-07-18 12:54:05 +0300 |
commit | f7f7c3016252a09acd68c822c8950848e313ce8a (patch) | |
tree | f3c816ff40bb639e1fa66002db10f9f6b53ea379 /app/workers | |
parent | 691d88b71d51786983b823207d876cee7c93f5d4 (diff) |
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.
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/gitlab_usage_ping_worker.rb | 6 |
1 files changed, 6 insertions, 0 deletions
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 |