From a841230aa7d199151ffe1cb21d33b9b0a7bd5eb5 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 15 Jun 2016 17:29:30 -0400 Subject: [bug] move the decryption to a threadpool too --- client/src/leap/soledad/client/encdecpool.py | 9 +++++++-- 1 file 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): -- cgit v1.2.3