Add in sleep between retries 5 seconds * retry

This commit is contained in:
Scott Zawalski 2010-11-16 09:27:17 -08:00
parent 3309df01c8
commit 01c62e5da6

View File

@ -10,6 +10,7 @@ import os
import re import re
import sys import sys
import tempfile import tempfile
import time
from chromite.lib import cros_build_lib from chromite.lib import cros_build_lib
""" """
@ -129,13 +130,14 @@ def RevGitPushWithRetry(retries=5):
Raises: Raises:
GitPushFailed if push was unsuccessful after retries GitPushFailed if push was unsuccessful after retries
""" """
for retry in range(retries+1): for retry in range(1, retries+1):
try: try:
cros_build_lib.RunCommand('repo sync .', shell=True) cros_build_lib.RunCommand('repo sync .', shell=True)
cros_build_lib.RunCommand('git push', shell=True) cros_build_lib.RunCommand('git push', shell=True)
break break
except cros_build_lib.RunCommandError: except cros_build_lib.RunCommandError:
print 'Error pushing changes trying again (%s/%s)' % (retry, retries) print 'Error pushing changes trying again (%s/%s)' % (retry, retries)
time.sleep(5*retry)
else: else:
raise GitPushFailed('Failed to push change after %s retries' % retries) raise GitPushFailed('Failed to push change after %s retries' % retries)