summaryrefslogtreecommitdiff
path: root/src/leap/mail/imap/mailbox.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-02-11 16:20:26 -0400
committerKali Kaneko <kali@leap.se>2014-02-17 11:39:49 -0400
commitf6566fe83c93625b918664526e8858f7be667354 (patch)
tree95770691226649c56777c5dedde69c08941fb8fe /src/leap/mail/imap/mailbox.py
parent484c5fc316c0f95ebccc4a2c2a04c1cda96a34f8 (diff)
defer appends too
and cut some more time by firing the callback as soon as we've got an UID.
Diffstat (limited to 'src/leap/mail/imap/mailbox.py')
-rw-r--r--src/leap/mail/imap/mailbox.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/leap/mail/imap/mailbox.py b/src/leap/mail/imap/mailbox.py
index 21f0554..7083316 100644
--- a/src/leap/mail/imap/mailbox.py
+++ b/src/leap/mail/imap/mailbox.py
@@ -111,6 +111,7 @@ class SoledadMailbox(WithMsgFields, MBoxParser):
last_uid_lock = threading.Lock()
_fdoc_primed = {}
+ _last_uid_primed = {}
def __init__(self, mbox, soledad, memstore, rw=1):
"""
@@ -294,10 +295,13 @@ class SoledadMailbox(WithMsgFields, MBoxParser):
"""
Prime memstore with last_uid value
"""
- mbox = self._get_mbox_doc()
- last = mbox.content.get('lastuid', 0)
- logger.info("Priming Soledad last_uid to %s" % (last,))
- self._memstore.set_last_soledad_uid(self.mbox, last)
+ primed = self._last_uid_primed.get(self.mbox, False)
+ if not primed:
+ mbox = self._get_mbox_doc()
+ last = mbox.content.get('lastuid', 0)
+ logger.info("Priming Soledad last_uid to %s" % (last,))
+ self._memstore.set_last_soledad_uid(self.mbox, last)
+ self._last_uid_primed[self.mbox] = True
def prime_known_uids_to_memstore(self):
"""
@@ -459,6 +463,9 @@ class SoledadMailbox(WithMsgFields, MBoxParser):
flags = tuple(str(flag) for flag in flags)
d = self._do_add_message(message, flags=flags, date=date)
+ if PROFILE_CMD:
+ do_profile_cmd(d, "APPEND")
+ # XXX should notify here probably
return d
def _do_add_message(self, message, flags, date):
@@ -467,13 +474,6 @@ class SoledadMailbox(WithMsgFields, MBoxParser):
Invoked from addMessage.
"""
d = self.messages.add_msg(message, flags=flags, date=date)
- # XXX Removing notify temporarily.
- # This is interfering with imaptest results. I'm not clear if it's
- # because we clutter the logging or because the set of listeners is
- # ever-growing. We should come up with some smart way of dealing with
- # it, or maybe just disabling it using an environmental variable since
- # we will only have just a few listeners in the regular desktop case.
- #d.addCallback(self.notify_new)
return d
def notify_new(self, *args):