Skip to content

Conversation

@Hywan
Copy link
Member

@Hywan Hywan commented Dec 2, 2025

The event has been sent to the server and the server has received it. Yepee! Now, we usually wait on the server to give us back the event via the sync.

Problem: sometimes the network lags, can be down, or the server may be slow; well, anything can happen. It results in a weird situation where the user sees its event being sent, then disappears before it's received again from the server.

To avoid this situation, this patch eagerly saves the event in the Event Cache. It's similar to what would happen if the event was echoed back from the server via the sync, but we avoid any network issues. The Event Cache is smart enough to deduplicate events based on the event ID, so it's safe to do that.


@codspeed-hq
Copy link

codspeed-hq bot commented Dec 2, 2025

CodSpeed Performance Report

Merging #5920 will not alter performance

Comparing Hywan:fix-issue-3941 (62373f9) with main (b4d7881)

Summary

✅ 50 untouched

Hywan added 4 commits December 3, 2025 10:42
The event has been sent to the server and the server has received it.
Yepee! Now, we usually wait on the server to give us back the event via
the sync.

Problem: sometimes the network lags, can be down, or the server may be
slow; well, anything can happen. It results in a weird situation where
the user sees its event being sent, then disappears before it's received
again from the server.

To avoid this situation, this patch eagerly saves the event in the Event
Cache. It's similar to what would happen if the event was echoed back
from the server via the sync, but we avoid any network issues. The Event
Cache is smart enought to deduplicate events based on the event ID, so
it's safe to do that.
This patch replaces calls to `SerializableEventContent::from_raw` by
`new`: it's simpler and safer as it's not possible to use an invalid
event type.
This patch fixes a mention to a `save_send_queue_event` method. It
doesn't exist: it's `save_send_queue_request`.
@Hywan Hywan marked this pull request as ready for review December 3, 2025 10:35
@Hywan Hywan requested a review from a team as a code owner December 3, 2025 10:35
@Hywan Hywan requested review from andybalaam and removed request for a team December 3, 2025 10:35
@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

❌ Patch coverage is 88.46154% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.65%. Comparing base (b4d7881) to head (62373f9).
⚠️ Report is 8 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
crates/matrix-sdk-sqlite/src/state_store.rs 30.00% 7 Missing ⚠️
...tes/matrix-sdk-base/src/store/integration_tests.rs 93.33% 1 Missing ⚠️
crates/matrix-sdk-base/src/store/send_queue.rs 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5920   +/-   ##
=======================================
  Coverage   88.65%   88.65%           
=======================================
  Files         363      363           
  Lines      104739   104737    -2     
  Branches   104739   104737    -2     
=======================================
+ Hits        92852    92855    +3     
+ Misses       7533     7528    -5     
  Partials     4354     4354           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@andybalaam andybalaam left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@Hywan Hywan merged commit aaff9c5 into matrix-org:main Dec 3, 2025
54 of 60 checks passed
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.

send queue: avoid losing local echoes when sent but not remote-echoed

2 participants