Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync: redownload messages that disappear from the maildir #42

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

robn
Copy link
Contributor

@robn robn commented Aug 14, 2022

If we detect a message that exists in notmuch, exists on the server, but is not in the maildir, treat it a little like a "new" message and redownload it from the server.

This is exploring a question that came out of the discussion on #33: what should mujmap do when confronted with a maildir that doesn't look quite right?

I think something like this is at least part of the right answer. notmuch is our local source of truth on what should exist. If it believes the message should exist, and the server doesn't have any changes on it, but its not in the maildir, that's clearly wrong and its no big deal to redownload the message.

I don't really think this is the "right" way to do this. Probably rather than weirdly forcing this into different points in the codepath, there should be an upfront flag on each NewEmail that indicates why we're doing the download. This was where I landed from just playing around though.

This also opens up options for future sanity checking modes, for example once we have blob checksums (#36) we can detect broken mail files as well, not just non-existent ones.

Something I had to consider right up front was whether a message could be removed from the maildir as part of notmuch's normal operation. As far as I can tell from reading its code, the answer is no. The only thing in notmuch that will notice a missing message in a maildir is notmuch new. I'm assuming that since mujmap is doing the work of coordinating the maildir and the notmuch index, notmuch new should not be in play. (If it is, then we have a bigger problem I think, because the index is no longer the source of truth).

What do you think?

@robn robn marked this pull request as draft August 14, 2022 05:58
If we detect a message that exists in notmuch, exists on the server, but
is not in the maildir, treat it a little like a "new" message and
redownload it from the server.
@robn robn force-pushed the redownload-lost-messages branch from bd4aa43 to 9db5ee6 Compare August 14, 2022 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant