9701: Set repack_small_blocks() method as @synchronized
authorLucas Di Pentima <lucas@curoverse.com>
Fri, 7 Oct 2016 20:27:41 +0000 (17:27 -0300)
committerLucas Di Pentima <lucas@curoverse.com>
Fri, 7 Oct 2016 20:27:41 +0000 (17:27 -0300)
sdk/python/arvados/arvfile.py

index a043bee75178957301faa5e8a9b12cb38ca57c9d..7100d056721ba08a2875c2d1414b816dbed88646 100644 (file)
@@ -549,6 +549,7 @@ class _BlockManager(object):
     def __exit__(self, exc_type, exc_value, traceback):
         self.stop_threads()
 
+    @synchronized
     def repack_small_blocks(self, force=False, sync=False):
         """Packs small blocks together before uploading"""
         # Search blocks ready for getting packed together before being committed to Keep
@@ -652,8 +653,9 @@ class _BlockManager(object):
         are uploaded.  Raises KeepWriteError() if any blocks failed to upload.
 
         """
+        self.repack_small_blocks(force=True, sync=True)
+
         with self.lock:
-            self.repack_small_blocks(force=True, sync=True)
             items = self._bufferblocks.items()
 
         for k,v in items: