Bump Gerrit fetch retry logic to 6 tries and 12s initial sleep

Upon Gerrit team's suggestion, up the retry time and number of retries
to handle increased replication delay.

Bug:b/285164390
Change-Id: If833ae9bb0f8c276b761970a8b5f96ec217d11b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4621268
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Gavin Mak <gavinmak@google.com>
changes/68/4621268/7
Gavin Mak 2 years ago committed by LUCI CQ
parent 85484cba70
commit fc75af35d4

@ -44,10 +44,11 @@ else:
from io import StringIO
LOGGER = logging.getLogger()
# With a starting sleep time of 10.0 seconds, x <= [1.8-2.2]x backoff, and five
# total tries, the sleep time between the first and last tries will be ~7 min.
TRY_LIMIT = 5
SLEEP_TIME = 10.0
# With a starting sleep time of 12.0 seconds, x <= [1.8-2.2]x backoff, and six
# total tries, the sleep time between the first and last tries will be ~6 min
# (excluding time for each try).
TRY_LIMIT = 6
SLEEP_TIME = 12.0
MAX_BACKOFF = 2.2
MIN_BACKOFF = 1.8

@ -390,7 +390,7 @@ class GerritUtilTest(unittest.TestCase):
self.assertEqual('content✔', gerrit_util.ReadHttpResponse(conn).getvalue())
self.assertEqual(2, len(conn.request.mock_calls))
gerrit_util.time_sleep.assert_called_once_with(10.0)
gerrit_util.time_sleep.assert_called_once_with(12.0)
def testReadHttpResponse_TimeoutAndSuccess(self):
conn = mock.Mock(req_params={'uri': 'uri', 'method': 'method'})
@ -401,7 +401,7 @@ class GerritUtilTest(unittest.TestCase):
self.assertEqual('content✔', gerrit_util.ReadHttpResponse(conn).getvalue())
self.assertEqual(2, len(conn.request.mock_calls))
gerrit_util.time_sleep.assert_called_once_with(10.0)
gerrit_util.time_sleep.assert_called_once_with(12.0)
def testReadHttpResponse_Expected404(self):
conn = mock.Mock()

Loading…
Cancel
Save