From dc8cf1fb338b6f072692c34a4e22a24551486b35 Mon Sep 17 00:00:00 2001 From: Jason Gunthorpe Date: Fri, 19 Jun 2020 11:10:46 -0300 Subject: Add debugging to try to find an assertion File "/home/jgg/oss/sync/cloud_mdir_sync/maildir.py", line 210, in force_content self._store_msg(msgs[content_hash]) File "/home/jgg/oss/sync/cloud_mdir_sync/maildir.py", line 145, in _store_msg self.msgdb.write_content(cloudmsg.content_hash, msg.fn) File "/home/jgg/oss/sync/cloud_mdir_sync/messages.py", line 279, in write_content assert content_hash in self.file_hashes Signed-off-by: Jason Gunthorpe --- cloud_mdir_sync/gmail.py | 3 +++ cloud_mdir_sync/main.py | 3 +++ cloud_mdir_sync/office365.py | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/cloud_mdir_sync/gmail.py b/cloud_mdir_sync/gmail.py index d17e536..b621577 100644 --- a/cloud_mdir_sync/gmail.py +++ b/cloud_mdir_sync/gmail.py @@ -327,6 +327,9 @@ class GMailMailbox(mailbox.Mailbox): self.gmail_messages = {} self.max_fetches = asyncio.Semaphore(10) + def __repr__(self): + return f"" + async def setup_mbox(self): """Setup access to the authenticated API domain for this endpoint""" self.name = f"{self.gmail.user}:{self.label_name}" diff --git a/cloud_mdir_sync/main.py b/cloud_mdir_sync/main.py index 1c86b4a..89daa11 100644 --- a/cloud_mdir_sync/main.py +++ b/cloud_mdir_sync/main.py @@ -20,6 +20,9 @@ def route_cloud_messages(cfg: config.Config) -> messages.MBoxDict_Type: msgs[mbox] = {} for mbox in cfg.cloud_mboxes: for ch, msg in mbox.messages.items(): + if ch not in cfg.msgdb.file_hashes: + config.logger.error( + f"Bad CH in route_cloud_messages {ch}, {mbox!r} {msg!r}") dest = cfg.direct_message(msg) msgs[dest][ch] = msg return msgs diff --git a/cloud_mdir_sync/office365.py b/cloud_mdir_sync/office365.py index 030254b..f66882f 100644 --- a/cloud_mdir_sync/office365.py +++ b/cloud_mdir_sync/office365.py @@ -488,6 +488,9 @@ class O365Mailbox(mailbox.Mailbox): self.graph = graph self.max_fetches = asyncio.Semaphore(10) + def __repr__(self): + return f"" + async def setup_mbox(self): """Setup access to the authenticated API domain for this endpoint""" cfg = self.cfg @@ -603,7 +606,9 @@ class O365Mailbox(mailbox.Mailbox): for msg in msgs: # Something went wrong? if msg.content_hash is not None: + assert msg.content_hash in self.msgdb.file_hashes res[msg.content_hash] = msg + self.messages = res self.need_update = False if not self.use_owa_subscribe: -- cgit v1.2.3