فهرست منبع

release lock properly if segment conversion crashes

Antoine Beaupré 9 سال پیش
والد
کامیت
6a72252b69
1فایلهای تغییر یافته به همراه5 افزوده شده و 3 حذف شده
  1. 5 3
      borg/converter.py

+ 5 - 3
borg/converter.py

@@ -27,9 +27,11 @@ class AtticRepositoryConverter(Repository):
         # partial open: just hold on to the lock
         self.lock = UpgradableLock(os.path.join(self.path, 'lock'),
                                    exclusive=True).acquire()
-        self.convert_segments(segments, dryrun)
-        self.lock.release()
-        self.lock = None
+        try:
+            self.convert_segments(segments, dryrun)
+        finally:
+            self.lock.release()
+            self.lock = None
         self.convert_cache(dryrun)
 
     @staticmethod