]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
storage.expirer: handle upgrades better
authorBrian Warner <warner@lothar.com>
Mon, 9 Mar 2009 03:42:20 +0000 (20:42 -0700)
committerBrian Warner <warner@lothar.com>
Mon, 9 Mar 2009 03:42:20 +0000 (20:42 -0700)
src/allmydata/storage/expirer.py

index 79254241105dca1c5bd169c19c519ef31e7a4b00..32913cb9e820f45f170b5ef80d2eccb544cc3dfb 100644 (file)
@@ -61,6 +61,10 @@ class LeaseCheckingCrawler(ShareCrawler):
         # get started: unit tests do this
         so_far = self.create_empty_cycle_dict()
         self.state.setdefault("cycle-to-date", so_far)
+        # in case we upgrade the code while a cycle is in progress, update
+        # the keys individually
+        for k in self.state["cycle-to-date"]:
+            self.state["cycle-to-date"].setdefault(k, so_far[k])
 
         # initialize history
         if not os.path.exists(self.historyfile):