From f0cf5fab004df99910fc54ceca7d88c3670ff8ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Augusto=20C=C3=A9sar?= Date: Sun, 22 Oct 2023 15:39:05 +0200 Subject: [PATCH] refactor: move session allocator to the branch where is used --- linkup-cli/src/local_server.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/linkup-cli/src/local_server.rs b/linkup-cli/src/local_server.rs index e1d4739..d162632 100644 --- a/linkup-cli/src/local_server.rs +++ b/linkup-cli/src/local_server.rs @@ -22,8 +22,6 @@ async fn linkup_config_handler( string_store: web::Data, req_body: web::Bytes, ) -> impl Responder { - let sessions = SessionAllocator::new(string_store.as_ref()); - let input_json_conf = match String::from_utf8(req_body.to_vec()) { Ok(input_json_conf) => input_json_conf, Err(_) => { @@ -35,6 +33,7 @@ async fn linkup_config_handler( match update_session_req_from_json(input_json_conf) { Ok((desired_name, server_conf)) => { + let sessions = SessionAllocator::new(string_store.as_ref()); let session_name = sessions .store_session(server_conf, NameKind::Animal, desired_name) .await;