aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-06-26 17:58:36 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-06-26 17:58:36 -0400
commit1960b05f63774b500f311c40e6c3c6efd9208848 (patch)
tree14158c0a61fef34b80a700a6c554d9b184baa3dd
parentf8f25627aef6f46fd95a27400876725fe51343a4 (diff)
downloadgrokmirror-1960b05f63774b500f311c40e6c3c6efd9208848.tar.gz
Remove empty siblings from consideration
Avoid unnecessary looping on empty (orphaned) siblings. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rwxr-xr-xgrokmirror/fsck.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/grokmirror/fsck.py b/grokmirror/fsck.py
index 236311f..d6eb8d8 100755
--- a/grokmirror/fsck.py
+++ b/grokmirror/fsck.py
@@ -754,7 +754,11 @@ def fsck_mirror(config, verbose=False, force=False, repack_only=False,
mdest = None
rcount = 0
# Who has the most remotes?
- for sibling in siblings:
+ for sibling in set(siblings):
+ if sibling not in amap or not len(amap[sibling]):
+ # Orphaned sibling, ignore it -- it will get cleaned up
+ siblings.remove(sibling)
+ continue
s_remotes = grokmirror.list_repo_remotes(sibling)
if len(s_remotes) > rcount:
mdest = sibling
@@ -798,6 +802,8 @@ def fsck_mirror(config, verbose=False, force=False, repack_only=False,
# XXX: Theoretically, nothing should have cloned a new repo while we were migrating, because
# they should have found a better candidate as well.
logger.info('%s: deleting (no longer used by anything)', os.path.basename(obstrepo))
+ if obstrepo in amap:
+ amap.pop(obstrepo)
shutil.rmtree(obstrepo)
continue