diff --git a/examples/dentry-simulator.rs b/examples/dentry-simulator.rs index f1368e65e8..27b1a1605e 100644 --- a/examples/dentry-simulator.rs +++ b/examples/dentry-simulator.rs @@ -342,6 +342,7 @@ async fn get_phaselock( known_nodes, next_view_timeout: 10000, timeout_ratio: (11, 10), + round_start_delay: 1, }; debug!(?config); let genesis = DEntryBlock::default(); diff --git a/src/lib.rs b/src/lib.rs index 7bc27dd12b..aa1c8add1a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -40,7 +40,7 @@ use std::sync::Arc; use std::time::Duration; use async_std::sync::RwLock; -use async_std::task::{spawn, yield_now, JoinHandle}; +use async_std::task::{sleep, spawn, yield_now, JoinHandle}; use dashmap::DashMap; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use snafu::ResultExt; @@ -214,6 +214,8 @@ pub struct PhaseLockConfig { pub next_view_timeout: u64, /// The exponential backoff ration for the next-view timeout pub timeout_ratio: (u64, u64), + /// The delay a leader inserts before starting pre-commit, in milliseconds + pub round_start_delay: u64, } /// Holds the state needed to participate in `PhaseLock` consensus @@ -484,6 +486,10 @@ impl + Sync + Send + 'static, const N: usize> PhaseLock