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