Skip to content

Commit 79f48a7

Browse files
committed
core: tree: retry fetches
Fetching the trees has gotten flaky lately. Retry up to 10 times. Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8fc078f commit 79f48a7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

core/tree.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import multiprocessing
88
import os
99
import tempfile
10+
import time
1011
from typing import List
1112

1213
import core
@@ -116,7 +117,14 @@ def git_merge_base(self, c1, c2, is_ancestor=False):
116117
return self.git(cmd)
117118

118119
def git_fetch(self, remote):
119-
return self.git(['fetch', remote])
120+
for i in range(10):
121+
try:
122+
return self.git(['fetch', remote])
123+
except CMD.CmdError as e:
124+
core.log(f"Fetching failed (attempt {i + 1})", repr(e))
125+
time.sleep(30)
126+
if i >= 9:
127+
raise
120128

121129
def git_reset(self, target, hard=False):
122130
cmd = ['reset', target]

0 commit comments

Comments
 (0)