diff options
author | Kali Kaneko <kali@leap.se> | 2013-12-19 13:30:10 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2013-12-19 13:30:10 -0400 |
commit | 0de2307c11338bf4c5e36dd9fe76f445b700c288 (patch) | |
tree | 0a26303691241605e510485f943b51d73fec9ffa | |
parent | f755b8c4aff56378923f1014ec95d7bced64afdf (diff) |
deferToThread unsetting recent flag
-rw-r--r-- | changes/bug_defer-unset-recent | 2 | ||||
-rw-r--r-- | src/leap/mail/imap/server.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/changes/bug_defer-unset-recent b/changes/bug_defer-unset-recent new file mode 100644 index 0000000..e651d11 --- /dev/null +++ b/changes/bug_defer-unset-recent @@ -0,0 +1,2 @@ + o deferToThread unsetting of recent flag. this was holding the new + mails from being displayed soonish. diff --git a/src/leap/mail/imap/server.py b/src/leap/mail/imap/server.py index b79e691..c79cf85 100644 --- a/src/leap/mail/imap/server.py +++ b/src/leap/mail/imap/server.py @@ -31,8 +31,10 @@ from zope.proxy import sameProxiedObjects from twisted.mail import imap4 from twisted.internet import defer +from twisted.internet.threads import deferToThread from twisted.python import log + from leap.common import events as leap_events from leap.common.events.events_pb2 import IMAP_UNREAD_MAIL from leap.common.check import leap_assert, leap_assert_type @@ -1648,7 +1650,8 @@ class SoledadMailbox(WithMsgFields): print "fetch %s, no msg found!!!" % msg_id if self.isWriteable(): - self._unset_recent_flag() + deferToThread(self._unset_recent_flag) + return tuple(result) def _unset_recent_flag(self): @@ -1668,6 +1671,7 @@ class SoledadMailbox(WithMsgFields): session is the first session to be notified about a message, then that message SHOULD be considered recent. """ + log.msg('unsetting recent flags...') for msg in (LeapMessage(doc) for doc in self.messages.recent_iter()): newflags = msg.removeFlags((WithMsgFields.RECENT_FLAG,)) self._update(newflags) |