mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-15 00:46:58 +02:00
Add in sleep between retries 5 seconds * retry
This commit is contained in:
parent
3309df01c8
commit
01c62e5da6
@ -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)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user