Skip to content
This repository was archived by the owner on Jul 2, 2025. It is now read-only.

Commit 1745fa9

Browse files
committed
speed up doc tests and fix comment typos
1 parent b6d3649 commit 1745fa9

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

examples/ha_setup/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ async fn main() -> anyhow::Result<()> {
6666
.await?;
6767
info!("First cache node started");
6868

69-
// Now just sleep until we ctrl + c so we can start the other members and observe the behavior
69+
// Now just sleep until we ctrl + c, so we can start the other members and observe the behavior
7070
time::sleep(Duration::from_secs(6000)).await;
7171

7272
// Let's simulate a graceful shutdown

src/lib.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,12 @@
277277
//! &mut cache_config_1,
278278
//! // optional notification channel: `Option<mpsc::Sender<CacheNotify>>`
279279
//! None,
280-
//! // We need to overwrite the hostname so we can start all nodes on the same host for this
280+
//! // We need to overwrite the hostname, so we can start all nodes on the same host for this
281281
//! // example. Usually, this will be set to `None`
282282
//! Some("127.0.0.1:7001".to_string()),
283283
//! )
284284
//! .await?;
285+
//! time::sleep(Duration::from_millis(100)).await;
285286
//! println!("First cache node started");
286287
//!
287288
//! // Mimic the other 2 cache members. This should usually not be done in the same code - only
@@ -295,6 +296,7 @@
295296
//! Some("127.0.0.1:7002".to_string()),
296297
//! )
297298
//! .await?;
299+
//! time::sleep(Duration::from_millis(100)).await;
298300
//! println!("2nd cache node started");
299301
//! // Now after the 2nd cache member has been started, we would already have quorum and a
300302
//! // working cache layer. As long as there is no leader and / or quorum, the cache will not
@@ -309,6 +311,7 @@
309311
//! Some("127.0.0.1:7003".to_string()),
310312
//! )
311313
//! .await?;
314+
//! time::sleep(Duration::from_millis(100)).await;
312315
//! println!("3rd cache node started");
313316
//!
314317
//! // For the sake of this example again, we need to wait until the cache is in a healthy
@@ -1004,12 +1007,12 @@ pub(crate) async fn insert_from_leader(
10041007
};
10051008

10061009
// double check, that we are really the leader
1007-
// this might get removed after enough testing, if it provides a performance benefit
10081010
if health_state.state != QuorumState::Leader && health_state.state != QuorumState::LeaderSwitch
10091011
{
1010-
let error = "Execution of 'insert_from_leader' is not allowed on a non-leader".to_string();
1011-
warn!("is_leader state: {:?}", health_state.state);
1012-
// TODO remove this panic after testing
1012+
let error = format!("Execution of 'insert_from_leader' is not allowed on a non-leader: {:?}", health_state.state);
1013+
error!("{}", error);
1014+
// TODO we once ended up here during conflict resolution -> try to reproduce
1015+
// rather panic than have an inconsistent state
10131016
panic!("{}", error);
10141017
}
10151018

0 commit comments

Comments
 (0)