summaryrefslogtreecommitdiffstats
path: root/src/swarm/sync.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-25 23:00:56 +0100
committertv <tv@krebsco.de>2026-10-25 23:00:56 +0100
commitc52d4b5ae43c202569c8801c312c2b56954ff8a0 (patch)
treedac7221b966d9f4fdb8e1b91b1e20bce607de6fc /src/swarm/sync.rs
parent2f7265795b7f6ddf460bf93c5f880fb24bde9d3a (diff)
add clock module
The Clock module is the system clock that every unix timestamp new goes through. It comes with an offset that only tests can set.
Diffstat (limited to 'src/swarm/sync.rs')
-rw-r--r--src/swarm/sync.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs
index d4503bb..a05e346 100644
--- a/src/swarm/sync.rs
+++ b/src/swarm/sync.rs
@@ -330,6 +330,7 @@ pub(crate) async fn handle_sync(
let epoch = envelope.epoch;
let message = envelope.message;
let peer = peer.to_owned();
+ let clock = Arc::clone(&state.clock);
// Some((caught_up, heads changed)) when applied, None when the message belongs
// to another epoch.
@@ -366,7 +367,7 @@ 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 = crate::state::unix_millis() as i64;
+ let now_ms = clock.now_millis() as i64;
// Time 0: not stamped (snapshots, older nodes).
let delays: Vec<i64> = replica
.doc