diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2022-03-13 19:36:22 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2022-03-13 19:36:22 +0100 |
commit | df031eef28db52d9b050843182818b4c4580f08e (patch) | |
tree | 583d9571fee73d6f8a72ccc2504655b6993f16e4 /hosts/vidhar/borg | |
parent | 1e7de7c2823a9beea7103249b732f14b1b1e8f78 (diff) | |
download | nixos-df031eef28db52d9b050843182818b4c4580f08e.tar nixos-df031eef28db52d9b050843182818b4c4580f08e.tar.gz nixos-df031eef28db52d9b050843182818b4c4580f08e.tar.bz2 nixos-df031eef28db52d9b050843182818b4c4580f08e.tar.xz nixos-df031eef28db52d9b050843182818b4c4580f08e.zip |
vidhar: borg: fix loop in copy
Diffstat (limited to 'hosts/vidhar/borg')
-rwxr-xr-x | hosts/vidhar/borg/copy.py | 12 |
1 files changed, 11 insertions, 1 deletions
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): | |||
71 | 71 | ||
72 | class ToSync: | 72 | class ToSync: |
73 | to_sync = deque() | 73 | to_sync = deque() |
74 | seen = set() | ||
74 | 75 | ||
75 | def __iter__(self): | 76 | def __iter__(self): |
76 | return self | 77 | return self |
77 | 78 | ||
78 | def __next__(self): | 79 | def __next__(self): |
79 | if self.to_sync: | 80 | if self.to_sync: |
80 | return self.to_sync.popleft() | 81 | next_repo = self.to_sync.popleft() |
82 | if next_repo['id'] in self.seen: | ||
83 | self.to_sync = deque() | ||
84 | self.seen = set() | ||
85 | next_repo = None | ||
86 | else: | ||
87 | self.seen.add(next_repo['id']) | ||
88 | |||
89 | if next_repo: | ||
90 | return next_repo | ||
81 | 91 | ||
82 | while True: | 92 | while True: |
83 | try: | 93 | try: |