diff options
author | Kali Kaneko <kali@leap.se> | 2015-06-25 09:42:25 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2015-06-25 11:56:53 -0400 |
commit | 0bc30f37c0f47a7b99e6e70a589fbc9b714cb297 (patch) | |
tree | 3f5d5a1650c946177cac0f44720483198601e618 /mail/src | |
parent | 4f31a8f8b5d851793e299bd84a6fff92cf9cd021 (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 'mail/src')
-rw-r--r-- | mail/src/leap/mail/adaptors/soledad.py | 10 | ||||
-rw-r--r-- | mail/src/leap/mail/imap/mailbox.py | 7 | ||||
-rw-r--r-- | mail/src/leap/mail/mail.py | 11 |
3 files changed, 24 insertions, 4 deletions
diff --git a/mail/src/leap/mail/adaptors/soledad.py b/mail/src/leap/mail/adaptors/soledad.py index dc0960fd..7e41f94f 100644 --- a/mail/src/leap/mail/adaptors/soledad.py +++ b/mail/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 diff --git a/mail/src/leap/mail/imap/mailbox.py b/mail/src/leap/mail/imap/mailbox.py index c4821ffb..72f5a433 100644 --- a/mail/src/leap/mail/imap/mailbox.py +++ b/mail/src/leap/mail/imap/mailbox.py @@ -504,8 +504,13 @@ class IMAPMailbox(object): getimapmsg = self.get_imap_message def get_imap_messages_for_range(msg_range): + print + print + print + print "GETTING FOR RANGE", msg_range def _get_imap_msg(messages): + print "GETTING IMAP MSG FOR", messages d_imapmsg = [] for msg in messages: d_imapmsg.append(getimapmsg(msg)) @@ -532,6 +537,7 @@ class IMAPMailbox(object): d = defer.gatherResults(d_msg, consumeErrors=True) d.addCallback(_get_imap_msg) d.addCallback(_zip_msgid) + d.addErrback(lambda failure: log.err(failure)) return d # for sequence numbers (uid = 0) @@ -542,6 +548,7 @@ class IMAPMailbox(object): else: d = self._get_messages_range(messages_asked) d.addCallback(get_imap_messages_for_range) + d.addErrback(lambda failure: log.err(failure)) return d diff --git a/mail/src/leap/mail/mail.py b/mail/src/leap/mail/mail.py index bf5b34d5..b4602b39 100644 --- a/mail/src/leap/mail/mail.py +++ b/mail/src/leap/mail/mail.py @@ -622,6 +622,12 @@ class MessageCollection(object): d = self.mbox_indexer.create_table(self.mbox_uuid) d.addBoth(lambda _: self.mbox_indexer.insert_doc( self.mbox_uuid, doc_id)) + # XXX--------------------------------- + def print_inserted(r): + print "INSERTED", r + return r + d.addCallback(print_inserted) + # XXX--------------------------------- return d d = wrapper.create( @@ -629,8 +635,9 @@ class MessageCollection(object): notify_just_mdoc=notify_just_mdoc, pending_inserts_dict=self._pending_inserts) d.addCallback(insert_mdoc_id, wrapper) - d.addErrback(lambda f: f.printTraceback()) - d.addCallback(self.cb_signal_unread_to_ui) + d.addErrback(lambda failure: log.err(failure)) + #d.addCallback(self.cb_signal_unread_to_ui) + return d def cb_signal_unread_to_ui(self, result): |