WIP: Look up message in notmuch instead of using heavy query #46
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Attempts to address #31.
So far this is pretty sloppy but it's the best I've been able to figure out with my limited knowledge of rust and types. In general, the approach is to look up the message in notmuch in each case rather than loading all messages in and looking up in that array.
So far I've been able to defer the heavy query in most cases but I'm stuck and could use some help cleaning this up. I've fallen back to having
email_exists_from_id
just return a bool since that's all I can wrap my head around. But later in the sync process, we actually need to get the message from the id.I've found
self.emails_from_message()
which does what I need but I'm stuck trying to return a message type. With that in place, I could go back and reimplement thelocal_email.blob_id != remote_email.blob_id
check.In general, this seems to perform substantially faster and I'm close to completely removing the heavy
local.all_emails()
query but could use some help getting past a few hurdles.