From 065bf2f9e738eae219da1fe0557ec22f94f10b7a Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 5 Nov 2026 16:10:14 +0100 Subject: waiting not twice --- src/swarm/sync.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/swarm/sync.rs') diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs index 0edc277..5511ea2 100644 --- a/src/swarm/sync.rs +++ b/src/swarm/sync.rs @@ -574,6 +574,7 @@ pub(crate) async fn handle_sync( peer_state.last_heads = Some((epoch, transport::HeadsSummary::of(message.heads().to_vec()))); let heads_before = replica.heads().to_vec(); + let said = message.heads().to_vec(); let sync = &mut peer_state.sync; replica @@ -617,7 +618,13 @@ pub(crate) async fn handle_sync( stats.new_changes(new); } if carried && !changed { - stats.nothing_new(payload_len, writer.is_some(), delivered, sizes); + // Its heads not ours yet: what it brought waits for predecessors, which + // isn't having come twice. + if !crate::document::changes::holds_all(&replica.doc, &said) { + stats.waiting(); + } else { + stats.nothing_new(payload_len, writer.is_some(), delivered, sizes); + } } // Whose they are, to pass them on along their writers' trees, however they // came (along a tree, with an answer, pulled). -- cgit v1.3.1