Reduce wait timings for Sidekiq jobs

This reduces the time spent waiting for Sidekiq jobs to complete in
JobWaiter, and reduces the sleep interval when trying to acquire the
lease for refreshing authorizations. These changes should reduce the
time spent just waiting for a lock, which we seem to be spending most
time in when running the AuthorizedProjectsWorker.
This commit is contained in:
Yorick Peterse 2017-06-19 16:12:05 +02:00
parent b18c12ec6a
commit d505a2b8e6
No known key found for this signature in database
GPG key ID: EDD30D2BEB691AC9
3 changed files with 6 additions and 2 deletions

View file

@ -34,7 +34,7 @@ module Users
# Keep trying until we obtain the lease. If we don't do so we may end up
# not updating the list of authorized projects properly. To prevent
# hammering Redis too much we'll wait for a bit between retries.
sleep(1)
sleep(0.1)
end
begin

View file

@ -0,0 +1,4 @@
---
title: Reduce time spent waiting for certain Sidekiq jobs to complete
merge_request:
author:

View file

@ -14,7 +14,7 @@ module Gitlab
# timeout - The maximum amount of seconds to block the caller for. This
# ensures we don't indefinitely block a caller in case a job takes
# long to process, or is never processed.
def wait(timeout = 60)
def wait(timeout = 10)
start = Time.current
while (Time.current - start) <= timeout