From fc6b9c0e1b197d435b95b7b385f4c4f65f91b632 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Wed, 7 Aug 2024 13:14:09 +0100 Subject: [PATCH] agent: stop statistics and cleanup when chat is stopped (#1251) --- src/Simplex/Messaging/Agent.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Simplex/Messaging/Agent.hs b/src/Simplex/Messaging/Agent.hs index c8ffe7a50..f7e70b721 100644 --- a/src/Simplex/Messaging/Agent.hs +++ b/src/Simplex/Messaging/Agent.hs @@ -235,6 +235,7 @@ logServersStats c = do liftIO $ threadDelay' delay int <- asks (logStatsInterval . config) forever $ do + atomically $ waitUntilActive c saveServersStats c liftIO $ threadDelay' int @@ -2112,6 +2113,7 @@ cleanupManager c@AgentClient {subQ} = do int <- asks (cleanupInterval . config) ttl <- asks $ storedMsgDataTTL . config forever $ do + atomically $ waitUntilActive c run ERR deleteConns run ERR $ withStore' c (`deleteRcvMsgHashesExpired` ttl) run ERR $ withStore' c (`deleteSndMsgsExpired` ttl)