From 29c4f58b15179ec3365fcd27b8fa0db0704535de Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 17 Feb 2022 19:59:45 +0100 Subject: vidhar: ... --- hosts/vidhar/borg/copy.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'hosts/vidhar') diff --git a/hosts/vidhar/borg/copy.py b/hosts/vidhar/borg/copy.py index 979dc5f4..d58b6060 100755 --- a/hosts/vidhar/borg/copy.py +++ b/hosts/vidhar/borg/copy.py @@ -27,6 +27,8 @@ from time import sleep from halo import Halo +from collections import deque + parser = argparse.ArgumentParser() parser.add_argument('source', metavar='REPO_OR_ARCHIVE') @@ -51,14 +53,14 @@ def read_repo(path): return res class ToSync: - to_sync = [] + to_sync = deque() def __iter__(self): return self def __next__(self): if self.to_sync: - return self.to_sync.pop() + return self.to_sync.popleft() while True: try: @@ -68,10 +70,10 @@ class ToSync: print(err, file=stderr) continue - self.to_sync = [entry for entry in src if entry['name'] not in {dst_entry['name'] for dst_entry in dst} and not entry['name'].endswith('.checkpoint')] + self.to_sync.extend([entry for entry in src if entry['name'] not in {dst_entry['name'] for dst_entry in dst} and not entry['name'].endswith('.checkpoint')]) if self.to_sync: - return self.to_sync.pop() + return self.to_sync.popleft() raise StopIteration -- cgit v1.2.3