summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-11-25 12:57:01 +0000
committerLars Wirzenius <liw@liw.fi>2012-11-25 12:57:01 +0000
commitae6880098b94135a71add7b390f773ec00c55452 (patch)
tree12bf7040d44637daeb75224ac92e6b952cf9395f
parentc5bed37ce438a4d5d12a0a0f099261cb103c5fa0 (diff)
downloadobnam-ae6880098b94135a71add7b390f773ec00c55452.tar.gz
Put work items from current one into queue in right place
If we have a queue [A, B, C], and we start processing A, and A generates A' and A'', we want to process them before B. Thus we put A' and A'' to the head of the queue. We also (now) remove the head of the queue rather than the tail. The old code tried to do all of these things, but was majorly confused.
-rw-r--r--obnamlib/plugins/fsck_plugin.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/obnamlib/plugins/fsck_plugin.py b/obnamlib/plugins/fsck_plugin.py
index 072a5c13..2b02fb01 100644
--- a/obnamlib/plugins/fsck_plugin.py
+++ b/obnamlib/plugins/fsck_plugin.py
@@ -214,6 +214,9 @@ class CheckClientlist(WorkItem):
def do(self):
logging.debug('Checking clientlist')
clients = self.repo.clientlist.list_clients()
+ for client_name in clients:
+ if client_name not in self.settings['fsck-ignore-client']:
+ yield CheckClientExists(client_name)
if not self.settings['fsck-skip-per-client-b-trees']:
for client_name in clients:
if client_name not in self.settings['fsck-ignore-client']:
@@ -222,9 +225,6 @@ class CheckClientlist(WorkItem):
yield CheckBTree(str(client_dir))
for client_name in clients:
if client_name not in self.settings['fsck-ignore-client']:
- yield CheckClientExists(client_name)
- for client_name in clients:
- if client_name not in self.settings['fsck-ignore-client']:
yield CheckClient(client_name)
@@ -330,23 +330,24 @@ class FsckPlugin(obnamlib.ObnamPlugin):
self.errors = 0
self.chunkids_seen = set()
self.work_items = []
- self.add_item(CheckRepository())
+ self.add_item(CheckRepository(), append=True)
final_items = []
if not self.app.settings['fsck-ignore-chunks']:
final_items.append(CheckForExtraChunks())
+
while self.work_items:
- work = self.work_items.pop()
+ work = self.work_items.pop(0)
logging.debug('doing: %s' % str(work))
self.app.ts['item'] = work
self.app.ts.increase('this_item', 1)
-# self.app.ts.flush()
- pos = len(self.work_items)
+ pos = 0
for more in work.do() or []:
self.add_item(more, pos=pos)
+ pos += 1
if not self.work_items:
for work in final_items:
- self.add_item(work)
+ self.add_item(work, append=True)
final_items = []
self.repo.unlock_shared()
@@ -369,9 +370,8 @@ class FsckPlugin(obnamlib.ObnamPlugin):
if append:
self.work_items.append(work)
else:
- self.work_items.insert(0, work)
+ self.work_items.insert(pos, work)
self.app.ts.increase('items', 1)
-# self.app.ts.flush()
def error(self, msg):
logging.error(msg)