diff options
author | Kali Kaneko <kali@leap.se> | 2016-06-15 17:29:30 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2016-06-15 17:29:30 -0400 |
commit | a841230aa7d199151ffe1cb21d33b9b0a7bd5eb5 (patch) | |
tree | 8f17b18f8b52e97cdd45bcc4577447f8766e80ca | |
parent | 48ff88a7781165b98285d6c25ec5d49d49cc3503 (diff) |
[bug] move the decryption to a threadpool too
-rw-r--r-- | client/src/leap/soledad/client/encdecpool.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/client/src/leap/soledad/client/encdecpool.py b/client/src/leap/soledad/client/encdecpool.py index e348f545..7e807dcf 100644 --- a/client/src/leap/soledad/client/encdecpool.py +++ b/client/src/leap/soledad/client/encdecpool.py @@ -178,9 +178,11 @@ class SyncEncrypterPool(SyncEncryptDecryptPool): secret = self._crypto.secret args = doc.doc_id, doc.rev, docstr, key, secret # encrypt asynchronously + # TODO use dedicated threadpool / move to ampoule d = threads.deferToThread( encrypt_doc_task, *args) d.addCallback(self._encrypt_doc_cb) + return d def _encrypt_doc_cb(self, result): """ @@ -429,9 +431,12 @@ class SyncDecrypterPool(SyncEncryptDecryptPool): secret = self._crypto.secret args = doc_id, doc_rev, content, gen, trans_id, key, secret, idx # decrypt asynchronously - doc = decrypt_doc_task(*args) + # TODO use dedicated threadpool / move to ampoule + d = threads.deferToThread( + decrypt_doc_task, *args) # callback will insert it for later processing - return self._decrypt_doc_cb(doc) + d.addCallback(self._decrypt_doc_cb) + return d def insert_received_doc( self, doc_id, doc_rev, content, gen, trans_id, idx): |