From df031eef28db52d9b050843182818b4c4580f08e Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 13 Mar 2022 19:36:22 +0100 Subject: vidhar: borg: fix loop in copy --- hosts/vidhar/borg/copy.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hosts/vidhar/borg/copy.py b/hosts/vidhar/borg/copy.py index 2ee4761d..46c9bcee 100755 --- a/hosts/vidhar/borg/copy.py +++ b/hosts/vidhar/borg/copy.py @@ -71,13 +71,23 @@ def read_repo(path): class ToSync: to_sync = deque() + seen = set() def __iter__(self): return self def __next__(self): if self.to_sync: - return self.to_sync.popleft() + next_repo = self.to_sync.popleft() + if next_repo['id'] in self.seen: + self.to_sync = deque() + self.seen = set() + next_repo = None + else: + self.seen.add(next_repo['id']) + + if next_repo: + return next_repo while True: try: -- cgit v1.2.3