diff options
Diffstat (limited to 'hosts/vidhar')
-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: |