Skip to content

Commit 623ff6f

Browse files
committed
chore(sliding sync): remove useless mutex around ExtensionsConfig
Signed-off-by: Benjamin Bouvier <[email protected]>
1 parent ce9a079 commit 623ff6f

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

crates/matrix-sdk/src/sliding_sync/builder.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
use std::{
2-
collections::BTreeMap,
3-
fmt::Debug,
4-
sync::{Mutex, RwLock as StdRwLock},
5-
};
1+
use std::{collections::BTreeMap, fmt::Debug, sync::RwLock as StdRwLock};
62

73
use ruma::{
84
api::client::sync::sync_events::v4::{
@@ -264,7 +260,7 @@ impl SlidingSyncBuilder {
264260
rooms,
265261
bump_event_types: self.bump_event_types,
266262

267-
extensions: Mutex::new(self.extensions),
263+
extensions: self.extensions.unwrap_or_default(),
268264
reset_counter: Default::default(),
269265

270266
position: StdRwLock::new(SlidingSyncPositionMarkers {

crates/matrix-sdk/src/sliding_sync/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use std::{
2727
fmt::Debug,
2828
sync::{
2929
atomic::{AtomicU8, Ordering},
30-
Arc, Mutex, RwLock as StdRwLock,
30+
Arc, RwLock as StdRwLock,
3131
},
3232
time::Duration,
3333
};
@@ -116,9 +116,9 @@ pub(super) struct SlidingSyncInner {
116116
/// Number of times a Sliding Sync session has been reset.
117117
reset_counter: AtomicU8,
118118

119-
/// The intended state of the extensions being supplied to Sliding Sync
120-
/// calls.
121-
extensions: Mutex<Option<ExtensionsConfig>>,
119+
/// Static configuration for extensions, passed in the slidinc sync
120+
/// requests.
121+
extensions: ExtensionsConfig,
122122

123123
/// Internal channel used to pass messages between Sliding Sync and other
124124
/// types.
@@ -260,7 +260,7 @@ impl SlidingSync {
260260
}
261261

262262
fn prepare_extension_config(&self, pos: Option<&str>) -> ExtensionsConfig {
263-
let mut extensions = { self.inner.extensions.lock().unwrap().clone().unwrap_or_default() };
263+
let mut extensions = self.inner.extensions.clone();
264264

265265
if pos.is_none() {
266266
// The pos is `None`, it's either our initial sync or the proxy forgot about us

0 commit comments

Comments
 (0)