Skip to content

fix: do not sort prefetched messages by INTERNALDATE#8136

Merged
link2xt merged 1 commit intomainfrom
link2xt/no-internaldate-sorting
Apr 19, 2026
Merged

fix: do not sort prefetched messages by INTERNALDATE#8136
link2xt merged 1 commit intomainfrom
link2xt/no-internaldate-sorting

Conversation

@link2xt
Copy link
Copy Markdown
Collaborator

@link2xt link2xt commented Apr 18, 2026

Messages are iterated over in fetch_new_msg_batch() and largest_uid_fetched variable is updated there
assuming that messages come in the order of increasing UID. If UIDs are not increasing, it is possible
that largest_uid_fetched will be updated
even though smaller UID is not fetched yet
and the message will be lost.

INTERNALDATE sorting was introduced to
deal with email providers such as Gmail
that keep INTERNALDATE but not the UID
order when moving the messages.
Since we don't move the messages anymore
after commit 04c0e7d, there is no need for ordering by INTERNALDATE.

Closes #7903

@link2xt link2xt self-assigned this Apr 18, 2026
@link2xt link2xt force-pushed the link2xt/no-internaldate-sorting branch from 90f56c7 to cbe8aab Compare April 18, 2026 17:48
Messages are iterated over in fetch_new_msg_batch()
and largest_uid_fetched variable is updated there
assuming that messages come in the order of increasing UID.
If UIDs are not increasing, it is possible
that largest_uid_fetched will be updated
even though smaller UID is not fetched yet
and the message will be lost.

INTERNALDATE sorting was introduced to
deal with email providers such as Gmail
that keep INTERNALDATE but not the UID
order when moving the messages.
Since we don't move the messages anymore
after commit 04c0e7d,
there is no need for ordering by INTERNALDATE.
@link2xt link2xt force-pushed the link2xt/no-internaldate-sorting branch from cbe8aab to b0985d9 Compare April 18, 2026 18:00
@link2xt link2xt merged commit bb816ff into main Apr 19, 2026
56 of 57 checks passed
@link2xt link2xt deleted the link2xt/no-internaldate-sorting branch April 19, 2026 09:00
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.

Sorting by INTERNALDATE may result in lost messages

2 participants