SSS: don't block if there is new extension data

This commit is contained in:
Lambda 2025-05-28 19:57:52 +00:00
parent 395d16ca22
commit d497a19c2d

View file

@ -499,9 +499,31 @@ pub(crate) async fn sync_events_v5_route(
}
}
let extensions = sync_events::v5::response::Extensions {
to_device,
e2ee: e2ee.unwrap_or_default(),
account_data: account_data.unwrap_or_default(),
receipts: sync_events::v5::response::Receipts {
rooms: BTreeMap::new(),
},
typing: sync_events::v5::response::Typing {
rooms: BTreeMap::new(),
},
};
let extensions_empty = extensions
.to_device
.as_ref()
.is_none_or(|to_device| to_device.events.is_empty())
&& extensions.e2ee.device_lists.is_empty()
&& extensions.account_data.is_empty()
&& extensions.receipts.is_empty()
&& extensions.typing.is_empty();
if rooms
.iter()
.all(|(_, r)| r.timeline.is_empty() && r.required_state.is_empty())
&& extensions_empty
{
// Hang a few seconds so requests are not spammed
// Stop hanging if new info arrives
@ -520,17 +542,7 @@ pub(crate) async fn sync_events_v5_route(
pos: next_batch.to_string(),
lists,
rooms,
extensions: sync_events::v5::response::Extensions {
to_device,
e2ee: e2ee.unwrap_or_default(),
account_data: account_data.unwrap_or_default(),
receipts: sync_events::v5::response::Receipts {
rooms: BTreeMap::new(),
},
typing: sync_events::v5::response::Typing {
rooms: BTreeMap::new(),
},
},
extensions,
}))
}