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(threading): Handle threads with duplicate send times #10176

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

ChristophWurst
Copy link
Member

A thread with two messages with identical sent_at result in a problematic situation. The backend will return both messages when listing the inbox. The front-end will de-duplicate and only show one of the two. At every browser-server sync, the picked duplicate will be replaced by the other message. At the next sync they are replaced again. Etc. This causes endless notifications.

I ran into this with a thread for an outgoing message that was replied to by the mail server. This seems to be the rare case where two messages in a thread have an identical send time because they were processed in the same second.

How to test

  1. Create a thread with two messages
  2. Go into the database, find the thread and change send_at to be identical for both messages
  3. Reload the app
  4. Wait for the sync

main: the two messages toggle.
here: only one of the messages is loaded and never replaced.


Note: I can't come up with a good way to find out which of the messages with identical send time are "newer". I just sort them by message id. It's a bit "random" semantically but keeps the sorting stable.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
@ChristophWurst ChristophWurst added bug 3. to review feature:threading papercut Annoying recurring issue with possibly simple fix. labels Sep 19, 2024
@ChristophWurst ChristophWurst self-assigned this Sep 19, 2024
Copy link
Member

@st3iny st3iny left a comment

Choose a reason for hiding this comment

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

Makes sense.

@st3iny st3iny merged commit cb71345 into main Oct 29, 2024
34 checks passed
@st3iny st3iny deleted the fix/threading/identical-send-time branch October 29, 2024 16:49
@ChristophWurst
Copy link
Member Author

/backport to stable3.7

@ChristophWurst
Copy link
Member Author

/backport to stable4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review bug feature:threading papercut Annoying recurring issue with possibly simple fix.
Projects
Status: ☑️ Done
Development

Successfully merging this pull request may close these issues.

3 participants