diff options
author | Kali Kaneko <kali@leap.se> | 2014-01-31 03:34:03 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2014-01-31 11:24:50 -0400 |
commit | 0f6a8e1c83995cffec51e81f626d4bb29d4f7345 (patch) | |
tree | 97d068f620403b4042058fcb6d6566c06a910177 /src/leap/mail/imap/fetch.py | |
parent | ff7de0c9bc760e097c0286d2d62a19095be3f35e (diff) |
properly implement deferreds in several commands
Passing along a deferred as an observer whose callback will be
called with the proper result.
Returning to thread in the appropiate points.
just let's remember that twisted APIs are not thread safe!
SoledadStore process_item also properly returned to thread.
Changed @deferred to @deferred_to_thread so it results less
confusing to read.
"know the territory". aha!
Diffstat (limited to 'src/leap/mail/imap/fetch.py')
-rw-r--r-- | src/leap/mail/imap/fetch.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/leap/mail/imap/fetch.py b/src/leap/mail/imap/fetch.py index 817ad6a..40dadb3 100644 --- a/src/leap/mail/imap/fetch.py +++ b/src/leap/mail/imap/fetch.py @@ -45,7 +45,7 @@ from leap.common.events.events_pb2 import IMAP_UNREAD_MAIL from leap.common.mail import get_email_charset from leap.keymanager import errors as keymanager_errors from leap.keymanager.openpgp import OpenPGPKey -from leap.mail.decorators import deferred +from leap.mail.decorators import deferred_to_thread from leap.mail.utils import json_loads from leap.soledad.client import Soledad from leap.soledad.common.crypto import ENC_SCHEME_KEY, ENC_JSON_KEY @@ -199,7 +199,7 @@ class LeapIncomingMail(object): logger.exception(failure.value) traceback.print_tb(*sys.exc_info()) - @deferred + @deferred_to_thread def _sync_soledad(self): """ Synchronizes with remote soledad. |