diff options
| author | tv <tv@krebsco.de> | 2026-10-31 06:54:59 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-31 06:54:59 +0100 |
| commit | 57e4a7335fcecbbfd06e4323c77aa077eedc48a5 (patch) | |
| tree | 50072231bc3fbbce361ff1644c6f4c3ecbcc6ac0 /src/swarm/sync.rs | |
| parent | d14ce65a9f30f31836a737a466c6086bda4ccbae (diff) | |
propagate clock figures
Diffstat (limited to 'src/swarm/sync.rs')
| -rw-r--r-- | src/swarm/sync.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs index 51144ac..18c017c 100644 --- a/src/swarm/sync.rs +++ b/src/swarm/sync.rs @@ -350,6 +350,7 @@ pub(crate) async fn handle_sync( let message = payload; let peer = peer.to_owned(); let clock = Arc::clone(&state.clock); + let ahead_ms = state.clock_ahead_ms.load(Ordering::Relaxed); // Some((caught_up, heads changed)) when applied, None when the message belongs // to another epoch. @@ -386,7 +387,9 @@ pub(crate) async fn handle_sync( stats.heads_seen(heads_after.len()); let changed = heads_after != heads_before; if changed && measure_propagation { - let now_ms = clock.now_millis().as_u64() as i64; + // Now by the peers' clocks (their median): this node's own clock skew + // doesn't count; the writer's still does. + let now_ms = clock.now_millis().as_u64() as i64 - ahead_ms; // Time 0: not stamped (snapshots, older nodes). let delays: Vec<i64> = replica .doc |
