From 06386239baa03a22a75202d9cf25328d8028a639 Mon Sep 17 00:00:00 2001 From: Mohamed Aouadhi Date: Wed, 23 Aug 2023 21:56:41 +0200 Subject: [PATCH] fix: remove unnecessary Mutex in SharedUsers --- src/lib/telegram/bot.rs | 4 ++-- src/lib/types.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/telegram/bot.rs b/src/lib/telegram/bot.rs index 1facae9..af068e7 100644 --- a/src/lib/telegram/bot.rs +++ b/src/lib/telegram/bot.rs @@ -108,11 +108,11 @@ impl Bot for TelegramBot { "Adding the user (id = {}), (name = {}).", user_id, user_name ); - users.insert(user_id, Mutex::new(BotUser::new())); + users.insert(user_id, BotUser::new()); }; let text = msg.get_message(); - let mut user = users.get_mut(&user_id).unwrap().lock().await; + let user = users.get_mut(&user_id).unwrap(); // update the user activity user.set_last_activity(chrono::Utc::now()).await; diff --git a/src/lib/types.rs b/src/lib/types.rs index 0b9adf6..ee85446 100644 --- a/src/lib/types.rs +++ b/src/lib/types.rs @@ -51,7 +51,7 @@ pub enum BotMessages { Message, // Telegram messages } -pub type SharedUsers = Arc>>>; +pub type SharedUsers = Arc>>; pub type CommandHashMap = HashMap>; #[async_trait]