summaryrefslogtreecommitdiff
path: root/src/leap/mail/adaptors
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-06-25 09:42:25 -0400
committerKali Kaneko <kali@leap.se>2015-06-25 11:56:53 -0400
commit9db1529e60cadff872cd3066e837e15413216b71 (patch)
treeb341965786a7d2feb0bc2f363f07e72e18664b72 /src/leap/mail/adaptors
parentc8dfed5b5f4ccb87003119f14e189566219365bb (diff)
[bug] saving message to drafts folder hangs
the bug consist on a fetch-while-pending-inserts hanging. the pending insert dict was not being cleaned up because the lookup for the Message-Id *is* case-sensitive (in the headers dict). by using a temporary all-keys-lowercase dict the lookup can be performed right, and the fetch returns successfully. at this point there's still a pending bug with Drafts, and it is that the new version is inserted but the MUA (TB) doesn't hide the older version (although a Delete flag is added). Resolves: #7189, #7190 Releases: 0.4.0
Diffstat (limited to 'src/leap/mail/adaptors')
-rw-r--r--src/leap/mail/adaptors/soledad.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/leap/mail/adaptors/soledad.py b/src/leap/mail/adaptors/soledad.py
index dc0960f..7e41f94 100644
--- a/src/leap/mail/adaptors/soledad.py
+++ b/src/leap/mail/adaptors/soledad.py
@@ -547,7 +547,9 @@ class MessageWrapper(object):
"Cannot create: fdoc has a doc_id")
def unblock_pending_insert(result):
- msgid = self.hdoc.headers.get('Message-Id', None)
+ h = self.hdoc.headers
+ ci_headers = dict([(k.lower(), v) for (k, v) in h.items()])
+ msgid = ci_headers.get('message-id', None)
try:
d = pending_inserts_dict[msgid]
d.callback(msgid)
@@ -561,6 +563,9 @@ class MessageWrapper(object):
mdoc_created = self.mdoc.create(store, is_copy=self._is_copy)
fdoc_created = self.fdoc.create(store, is_copy=self._is_copy)
+ mdoc_created.addErrback(lambda f: log.err(f))
+ fdoc_created.addErrback(lambda f: log.err(f))
+
self.d.append(mdoc_created)
self.d.append(fdoc_created)
@@ -580,9 +585,10 @@ class MessageWrapper(object):
self.all_inserted_d = defer.gatherResults(self.d, consumeErrors=True)
self.all_inserted_d.addCallback(log_all_inserted)
+ self.all_inserted_d.addCallback(unblock_pending_insert)
+ self.all_inserted_d.addErrback(lambda failure: log.err(failure))
if notify_just_mdoc:
- self.all_inserted_d.addCallback(unblock_pending_insert)
return mdoc_created
else:
return self.all_inserted_d