summaryrefslogtreecommitdiff
path: root/src/leap/mail/imap
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-02-17 12:18:41 -0400
committerKali Kaneko <kali@leap.se>2014-02-17 20:42:23 -0400
commitdaa0c9fd588c61f2e440453be83af137779ce207 (patch)
treeca4dd46133ef724c972132c7e7f18559b18e6ef6 /src/leap/mail/imap
parent6f98424d41b38d5e56f54f312a6de871e3a82daa (diff)
cache uidvalidity
Diffstat (limited to 'src/leap/mail/imap')
-rw-r--r--src/leap/mail/imap/mailbox.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/leap/mail/imap/mailbox.py b/src/leap/mail/imap/mailbox.py
index 57505f0..6513db9 100644
--- a/src/leap/mail/imap/mailbox.py
+++ b/src/leap/mail/imap/mailbox.py
@@ -149,6 +149,8 @@ class SoledadMailbox(WithMsgFields, MBoxParser):
self.messages = MessageCollection(
mbox=mbox, soledad=self._soledad, memstore=self._memstore)
+ self._uidvalidity = None
+
# XXX careful with this get/set (it would be
# hitting db unconditionally, move to memstore too)
# Now it's returning a fixed amount of flags from mem
@@ -339,8 +341,10 @@ class SoledadMailbox(WithMsgFields, MBoxParser):
:return: unique validity identifier
:rtype: int
"""
- mbox = self._get_mbox_doc()
- return mbox.content.get(self.CREATED_KEY, 1)
+ if self._uidvalidity is None:
+ mbox = self._get_mbox_doc()
+ self._uidvalidity = mbox.content.get(self.CREATED_KEY, 1)
+ return self._uidvalidity
def getUID(self, message):
"""