summaryrefslogtreecommitdiffstats
path: root/src/simtest/mod.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-25 22:21:06 +0100
committertv <tv@krebsco.de>2026-10-25 22:21:06 +0100
commitcd9f068270e2258c571bbc01465fcf39f054848b (patch)
tree2f7656d83738f2e199d20110fb710e9b26015844 /src/simtest/mod.rs
parent34989e5140eaa16e17a0ab4501e64e779215e3d1 (diff)
make sync reply timeout part of timing
This enables upcoming lossy-links tests.
Diffstat (limited to 'src/simtest/mod.rs')
-rw-r--r--src/simtest/mod.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/simtest/mod.rs b/src/simtest/mod.rs
index 2e33310..f0fee02 100644
--- a/src/simtest/mod.rs
+++ b/src/simtest/mod.rs
@@ -24,14 +24,16 @@ use crate::document::replica::Epoch;
use crate::document::store;
use crate::files::Files;
use crate::node::{self, Node, NodeConfig};
-use crate::state::{AppState, PeerState};
+use crate::state::{AppState, PeerState, Timing};
use crate::swarm::bootstrap::{self, Start};
use crate::transport::sim::SimNet;
/// Keepalive of simulated nodes: dormancy after 1 s, probes of dormant peers every
-/// 2.5 s (`Timing::from_keepalive`). Sync reply timeouts and heals don't scale with it
-/// (10 s and 20 s at least).
+/// 2.5 s (`Timing::new`).
pub(crate) const KEEPALIVE: Duration = Duration::from_millis(250);
+/// First wait for a sync answer before sending again (10 s in production, where large
+/// messages take a while): a lost sync message costs a test 1 s, a heal 2 s.
+pub(crate) const SYNC_REPLY_TIMEOUT: Duration = Duration::from_secs(1);
/// A simulated swarm: the net and the nodes started on it.
pub(crate) struct Sim {
@@ -69,7 +71,7 @@ impl Sim {
initial_epoch: Epoch::GENESIS,
initial_doc: AutoCommit::new(),
earlier_actors: Vec::new(),
- keepalive: KEEPALIVE,
+ timing: Timing::new(KEEPALIVE, SYNC_REPLY_TIMEOUT),
neighbours_k: 8,
alias: Some(id.to_owned()),
electorate_window: Duration::from_secs(30 * 24 * 3600),