atagen

matrix-rust-sdk

public
Star0
Watch0

Commit 0e8b88a00ce2

tarball

atagen <boss@atagen.co>2026-10-27 04:45 UTC

2 files changed+7-0
event-cache: skip the history coordinator when no sync hole is recorded

`probe_sync_hole` runs every 30s for each open room, and queued a `HistoryOperation::ProbeSyncHole` behind fills and restores even when `take_sync_hole` would find nothing. A read of the state answers that without the queue.
Modified file: crates/matrix-sdk/src/event_cache/caches/room/history.rs+3 additions
@@ -448,6 +448,9 @@ impl RoomEventCache {
448448
449449 #[doc = "Looks once behind the newest previous-batch token a non-limited sync handed out. Answers None when there was none, else how many unknown events it inserted."]
450450 pub async fn probe_sync_hole(&self) -> Result<Option<usize>> {
451+ if !self.inner.state.read().await?.has_sync_hole() {
452+ return Ok(None);
453+ }
451454 match self.request_history(HistoryOperation::ProbeSyncHole).await? {
452455 HistoryResponse::Probe(outcome) => Ok(outcome),
453456 _ => unreachable!("coordinator response matches request"),
Modified file: crates/matrix-sdk/src/event_cache/caches/room/state.rs+4 additions
@@ -462,6 +462,10 @@ impl<'a> RoomEventCacheStateLockReadGuard<'a> {
462462 super::history::gap_positions(&self.state.room_linked_chunk)
463463 }
464464
465+ pub(super) fn has_sync_hole(&self) -> bool {
466+ self.state.sync_hole.is_some()
467+ }
468+
465469 /// Return the subscriber count.
466470 pub fn subscriber_count(&self) -> &Arc<AtomicUsize> {
467471 &self.state.subscriber_count