From 3db1bf5014036087c2df6a746759c4df290330c4 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 5 Nov 2026 04:56:18 +0100 Subject: push only below deflate --- src/swarm/sync.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/swarm/sync.rs') diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs index d28df33..681a3bb 100644 --- a/src/swarm/sync.rs +++ b/src/swarm/sync.rs @@ -169,9 +169,15 @@ async fn deliver_sync_to_peer(state: &AppState, peer: &str) -> Result<()> { Instant::now(), ); // Along a tree, taken as delivered: the changes as they are, if pushing - // (`AppState::push_changes`). + // (`AppState::push_changes`). Only those too small to deflate: larger + // ones go as a message, deflated (`compress`). let pushed = (push_changes && level && writer.is_some() && again.is_none()) - .then(|| peer_state.sync.push(&replica.doc, delta_threshold)) + .then(|| { + peer_state.sync.push( + &replica.doc, + delta_threshold.min(crate::compress::WORTH_FROM - 1), + ) + }) .flatten(); let body = if let Some((heads, changes)) = pushed { Some(transport::SyncBody::Changes { -- cgit v1.3.1