feat(event cache): include read receipts that were dormant in the state store#6406
feat(event cache): include read receipts that were dormant in the state store#6406
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6406 +/- ##
==========================================
+ Coverage 89.85% 89.86% +0.01%
==========================================
Files 378 378
Lines 103384 103372 -12
Branches 103384 103372 -12
==========================================
+ Hits 92893 92895 +2
+ Misses 6928 6910 -18
- Partials 3563 3567 +4 ☔ View full report in Codecov by Sentry. |
e35f7a3 to
dfd75c9
Compare
Merging this PR will improve performance by ×2.5
Performance Changes
Comparing |
| ) { | ||
| // Implementation note: we want to prioritize a `ReadPrivate` (private) receipt | ||
| // over a `Read` (public) one, as it's more likely to be ahead. | ||
| for receipt_type in [ReceiptType::ReadPrivate, ReceiptType::Read] { |
There was a problem hiding this comment.
It might make sense to put this array into a global const since it's now used here as well as in select_best_receipt().
While it's not very likely that we're going to extend the interesting ReceiptTypes any time soon, when we do so, it's likely that those two places will need to be extended in the same manner.
When computing unread counts, if there was no read receipt marked as
latest_active, it could be that a read receipt was dormant in the state store, before the code was migrated. In this case, we wouldn't take it into account for the current room, and this would result in an incorrect unread count for that room, until a new receipt is sent for that room.I think this fixes #6211, as this situation would likely arise for a user with sync v2, migrating to the new SDK where the event cache handles read receipts.
CHANGELOG.mdfiles.