diff --git a/examples/memstore/src/main.rs b/examples/memstore/src/main.rs index 353082b2..f4452387 100644 --- a/examples/memstore/src/main.rs +++ b/examples/memstore/src/main.rs @@ -67,13 +67,12 @@ async fn leader_id(data: web::Data<(HashStore, Raft)>) -> i format!("{:?}", leader_id) } -// #[get("/leave")] -// async fn leave( -// data: web::Data<(HashStore, Raft)>, -// ) -> impl Responder { -// data.leave().await.unwrap(); -// "OK".to_string() -// } +#[get("/leave")] +async fn leave(data: web::Data<(HashStore, Raft)>) -> impl Responder { + let raft = data.clone(); + raft.1.raft_node.clone().leave().await; + "OK".to_string() +} #[actix_rt::main] async fn main() -> std::result::Result<(), Box> {