diff options
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 |
