From e97ae487edd59e781a2e63e0649e8b6f026c7620 Mon Sep 17 00:00:00 2001 From: Gyubong Date: Tue, 2 Jan 2024 14:51:02 +0900 Subject: [PATCH] Update main.rs --- examples/memstore/src/main.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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> {