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

Fix lower bound when fetching a range of IMAP messages for the sync #2920

Merged
merged 1 commit into from
Apr 16, 2020

Conversation

ChristophWurst
Copy link
Member

@ChristophWurst ChristophWurst commented Apr 16, 2020

Fixes #2909

When we fetch messages for the initial sync, we use a UID range. There is a bit of logic involved to only fetch roughly $maxResults messages, and we might have a known offset $highestKnownUid to take into account for resumed sync's. The code previously always set the lower range bound to $highestKnownUid + 1, so for the very first sync attempt the range was like 0:$maxResults. If the UIDs of a mailbox start after $maxResults, no messages were returned. And the logic entered an infinite retry loop.

Now, the new logic starts at $min, the lowest known UID reported by the server or at $highestKnownUid, whichever is higher. The upper bound is calculated based on the lower bound.

If my train of thought is not derailing, this should give the correct range to fetch. I can still correctly sync all messages with my test accounts.

TODO

@ChristophWurst
Copy link
Member Author

@skjnldsv remember
Bildschirmfoto von 2020-04-16 16-59-22

🙊

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Copy link
Member

@skjnldsv skjnldsv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code make sense! Did not saw anything crazy! 🚀

@ChristophWurst ChristophWurst force-pushed the fix/find-all-messages-lower-bound branch from 0da3d78 to 8fafd26 Compare April 16, 2020 16:45
@ChristophWurst ChristophWurst merged commit c66a26f into master Apr 16, 2020
@ChristophWurst ChristophWurst deleted the fix/find-all-messages-lower-bound branch April 16, 2020 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot load mail anymore since upgrade to 1.3.0
2 participants