diff options
Diffstat (limited to 'src/simtest/mod.rs')
| -rw-r--r-- | src/simtest/mod.rs | 10 |
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), |
