matrix-org / matrix-rust-sdk

Matrix Client-Server SDK for Rust
Apache License 2.0
1.27k stars 254 forks source link

refactor(send queue): use a specialized mutex for locking access to the state store and `being_sent` #4268

Closed bnjbvr closed 1 week ago

bnjbvr commented 1 week ago

There was an implicit relationship that the being_sent lock needed to be taken in order to do non-atomic state store operations. With the change from this commit, the relationship is now more explicit: to get a handle to the state store, or being_sent, you have to obtain a StoreLockGuard by locking against the store itself. The WeakClient isn't stored in the QueueStorage data structure itself, so it's the only way to get a dyn StateStore from the QueueStorage.

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 85.02%. Comparing base (a8a83c3) to head (01ed8ad). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #4268 +/- ## ========================================== - Coverage 85.03% 85.02% -0.01% ========================================== Files 274 274 Lines 30028 30039 +11 ========================================== + Hits 25533 25541 +8 - Misses 4495 4498 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.