aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-05 04:56:18 +0100
committertv <tv@krebsco.de>2026-11-05 04:56:18 +0100
commit3db1bf5014036087c2df6a746759c4df290330c4 (patch)
tree4a8d33ca9359ce2490511d0d1a86c33b2c5e57db /src/swarm
parent784c6e7c9088dde2f23cc1d02381a0c5fe8b010b (diff)
push only below deflate
Diffstat (limited to 'src/swarm')
-rw-r--r--src/swarm/sync.rs10
1 files changed, 8 insertions, 2 deletions
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 {