fix: When receiving MDN, mark all preceding messages as noticed, even having same timestamp (#7928)#8046
Merged
fix: When receiving MDN, mark all preceding messages as noticed, even having same timestamp (#7928)#8046
Conversation
This way it's easier to debug issues like `MsgsNoticed` not emitted for a chat.
iequidoo
commented
Mar 26, 2026
src/receive_imf.rs
Outdated
| hidden=0 AND | ||
| chat_id=? AND | ||
| timestamp<?", | ||
| state=?2 AND hidden=0 AND chat_id=?3 AND timestamp<?4 OR |
Collaborator
Author
There was a problem hiding this comment.
EXPLAIN QUERY PLAN UPDATE msgs SET state=? WHERE state=? AND hidden IN (0,1) AND chat_id=? AND (timestamp,id)<(?,?);
QUERY PLAN
`--SEARCH msgs USING INDEX msgs_index7 (state=? AND hidden=? AND chat_id=? AND timestamp<?)Let's prepare for adding timestamp to msgs_index7, it's not the only place where timestamp speeds up a query, e.g. building chatlists is also sped up. See also #7904 for why hidden IN (0,1) (instead of hidden=0) is used in EXPLAIN QUERY PLAN.
Collaborator
Author
There was a problem hiding this comment.
EDIT: SQLite supports tuple comparison, so i updated the query in the PR
Collaborator
Author
|
|
… having same timestamp (#7928) This fixes flaky JSON-RPC `test_multidevice_sync_seen`.
link2xt
approved these changes
Mar 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This fixes flaky JSON-RPC
test_multidevice_sync_seen.Fix #7928