janitor/ab-janitor: attempt initial clones until success
PATCH 1/1 janitor/ab-janitor: attempt initial clones until success
If the git clone operations don't succeed the mirror_processor thread will spin updating nothing and index builds will fail. Instead the thread will attempt the clones as many times as needed logging each failure.
These are bare mirrors so look for the refs dir instead of .git.
Signed-off-by Michael Halstead <[email protected]>
--- janitor/ab-janitor | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
janitor/ab-janitor +6 -2
@@ -65,8 +65,12 @@ def mirror_processor(mirrordir): mirror = ourconfig["repo-defaults"][repo]["url"] mirrorpath = os.path.join(mirrordir, repo) mirrorpaths.append(mirrorpath) - if not os.path.exists(mirrorpaths[-1] + "/.git/"): - os.system("git clone --bare --mirror %s %s" % (mirror, mirrorpaths[-1])) + while not os.path.exists(mirrorpath + "/refs"): + exit_code = os.system("git clone --bare --mirror %s %s" % (mirror, mirrorpath)) + if exit_code == 0: + break + print("Failed to clone %s. Retrying in 30 seconds..." % mirror) + time.sleep(30) while True: for path in mirrorpaths: os.chdir(path)
Signature · 1 line
2.49.0