From c0eb5ba4126d953dd095a6ffb072699c9be5e597 Mon Sep 17 00:00:00 2001 From: Akulij Date: Sat, 7 Jun 2025 02:59:07 +0500 Subject: [PATCH] bot_manager: fix MutexGuard lifetime --- src/bot_manager.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bot_manager.rs b/src/bot_manager.rs index 1c72e0a..5d91685 100644 --- a/src/bot_manager.rs +++ b/src/bot_manager.rs @@ -218,9 +218,10 @@ pub async fn spawn_notificator_thread( rt.block_on(async { loop { - let r = c.runtime.lock().expect("Poisoned Runtime lock"); - let notifications = r.rc.get_nearest_notifications(); - drop(r); // unlocking mutex + let notifications = { + let r = c.runtime.lock().expect("Poisoned Runtime lock"); + r.rc.get_nearest_notifications() + }; match notifications { Some(n) => {