Skip to content

Commit 992bf3c

Browse files
committed
I've seen too much fetch failing.
1 parent c89d398 commit 992bf3c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

build_docs.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from contextlib import suppress, contextmanager
2626
from dataclasses import dataclass
2727
from datetime import datetime as dt, timezone
28-
from time import perf_counter
28+
from time import perf_counter, sleep
2929
import filecmp
3030
import json
3131
import logging
@@ -280,6 +280,15 @@ class Repository:
280280
remote: str
281281
directory: Path
282282

283+
def fetch(self):
284+
"""Try (and retry) to run git fetch."""
285+
try:
286+
return self.run("fetch")
287+
except subprocess.CalledProcessError as err:
288+
logging.error("'git fetch' failed (%s), retrying...", err.stderr)
289+
sleep(5)
290+
return self.run("fetch")
291+
283292
def run(self, *args):
284293
"""Run git command in the clone repository."""
285294
return run(("git", "-C", self.directory) + args)

0 commit comments

Comments
 (0)