summaryrefslogtreecommitdiff
path: root/mail/src/leap/mail/imap/messageparts.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-02-11 01:43:14 -0400
committerKali Kaneko <kali@leap.se>2014-02-17 11:39:48 -0400
commitd6c352a72766a17df9d3804f58890b876370bc93 (patch)
treed883fbb45e5e4c7f5b30bb5fa6e49888d4879b66 /mail/src/leap/mail/imap/messageparts.py
parent5bba9574dd0a8906178a928e4b7e8f1877a75a12 (diff)
separate new and dirty queues
Diffstat (limited to 'mail/src/leap/mail/imap/messageparts.py')
-rw-r--r--mail/src/leap/mail/imap/messageparts.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/mail/src/leap/mail/imap/messageparts.py b/mail/src/leap/mail/imap/messageparts.py
index b1f333a..9b7de86 100644
--- a/mail/src/leap/mail/imap/messageparts.py
+++ b/mail/src/leap/mail/imap/messageparts.py
@@ -98,7 +98,7 @@ class MessageWrapper(object):
CDOCS = "cdocs"
DOCS_ID = "docs_id"
- # Using slots to limit some the memory footprint,
+ # Using slots to limit some the memory use,
# Add your attribute here.
__slots__ = ["_dict", "_new", "_dirty", "_storetype", "memstore"]
@@ -148,7 +148,7 @@ class MessageWrapper(object):
"""
return self._new
- def _set_new(self, value=True):
+ def _set_new(self, value=False):
"""
Set the value for the `new` flag, and propagate it
to the memory store if any.
@@ -161,8 +161,8 @@ class MessageWrapper(object):
mbox = self.fdoc.content['mbox']
uid = self.fdoc.content['uid']
key = mbox, uid
- fun = [self.memstore.unset_new,
- self.memstore.set_new][int(value)]
+ fun = [self.memstore.unset_new_queued,
+ self.memstore.set_new_queued][int(value)]
fun(key)
else:
logger.warning("Could not find a memstore referenced from this "
@@ -193,8 +193,8 @@ class MessageWrapper(object):
mbox = self.fdoc.content['mbox']
uid = self.fdoc.content['uid']
key = mbox, uid
- fun = [self.memstore.unset_dirty,
- self.memstore.set_dirty][int(value)]
+ fun = [self.memstore.unset_dirty_queued,
+ self.memstore.set_dirty_queued][int(value)]
fun(key)
else:
logger.warning("Could not find a memstore referenced from this "
@@ -271,11 +271,14 @@ class MessageWrapper(object):
:rtype: generator
"""
if self._dirty:
- mbox = self.fdoc.content[fields.MBOX_KEY]
- uid = self.fdoc.content[fields.UID_KEY]
- docid_dict = self._dict[self.DOCS_ID]
- docid_dict[self.FDOC] = self.memstore.get_docid_for_fdoc(
- mbox, uid)
+ try:
+ mbox = self.fdoc.content[fields.MBOX_KEY]
+ uid = self.fdoc.content[fields.UID_KEY]
+ docid_dict = self._dict[self.DOCS_ID]
+ docid_dict[self.FDOC] = self.memstore.get_docid_for_fdoc(
+ mbox, uid)
+ except Exception as exc:
+ logger.exception(exc)
if not empty(self.fdoc.content):
yield self.fdoc