cleanup pithos backend pools, new pool api support
[pithos] / snf-pithos-app / pithos / api / util.py
index fc10f42..f8233f9 100644 (file)
@@ -822,6 +822,9 @@ class PithosBackendPool(ObjectPool):
         backend._use_count = USAGE_LIMIT
         return backend
 
         backend._use_count = USAGE_LIMIT
         return backend
 
+    def _pool_verify(self, backend):
+        return 1
+
     def _pool_cleanup(self, backend):
         c = backend._use_count - 1
         if c < 0:
     def _pool_cleanup(self, backend):
         c = backend._use_count - 1
         if c < 0:
@@ -829,6 +832,10 @@ class PithosBackendPool(ObjectPool):
             return True
 
         backend._use_count = c
             return True
 
         backend._use_count = c
+        if backend.trans is not None:
+            backend.wrapper.rollback()
+        if backend.messages:
+            backend.messages = []
         return False
 
 _pithos_backend_pool = PithosBackendPool(size=POOL_SIZE)
         return False
 
 _pithos_backend_pool = PithosBackendPool(size=POOL_SIZE)