summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2016-05-01 13:58:28 -0400
committerdrebs <drebs@leap.se>2016-05-03 10:52:25 -0300
commitb7b7ddaeca42a9cde43c99cf6e3f9a937e5490a8 (patch)
treecf1fe5b7b8ff56341a318f5519b5fbb4b4d469e4
parent33ecd8375e80e452486b727c2ef54d67d330505c (diff)
[feature] use deferred semaphore
-rw-r--r--client/changes/next-changelog.rst1
-rw-r--r--client/src/leap/soledad/client/adbapi.py4
2 files changed, 3 insertions, 2 deletions
diff --git a/client/changes/next-changelog.rst b/client/changes/next-changelog.rst
index 93d90901..bd56c857 100644
--- a/client/changes/next-changelog.rst
+++ b/client/changes/next-changelog.rst
@@ -10,6 +10,7 @@ I've added a new category `Misc` so we can track doc/style/packaging stuff.
Features
~~~~~~~~
+- Use DeferredLock instead of its locking cousin.
- `#1234 <https://leap.se/code/issues/1234>`_: Description of the new feature corresponding with issue #1234.
- New feature without related issue number.
diff --git a/client/src/leap/soledad/client/adbapi.py b/client/src/leap/soledad/client/adbapi.py
index 77822247..c2fbb06e 100644
--- a/client/src/leap/soledad/client/adbapi.py
+++ b/client/src/leap/soledad/client/adbapi.py
@@ -24,9 +24,9 @@ import sys
import logging
from functools import partial
-from threading import BoundedSemaphore
from twisted.enterprise import adbapi
+from twisted.internet.defer import DeferredSemaphore
from twisted.python import log
from zope.proxy import ProxyBase, setProxiedObject
from pysqlcipher.dbapi2 import OperationalError
@@ -204,7 +204,7 @@ class U1DBConnectionPool(adbapi.ConnectionPool):
:rtype: twisted.internet.defer.Deferred
"""
meth = "u1db_%s" % meth
- semaphore = BoundedSemaphore(SQLCIPHER_MAX_RETRIES - 1)
+ semaphore = DeferredSemaphore(SQLCIPHER_MAX_RETRIES - 1)
def _run_interaction():
return self.runInteraction(