From cc75b75d4e9a200e680bd8b4d5caf055c82ec364 Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Mon, 29 May 2023 11:19:03 +0400 Subject: [PATCH] core: remove timing events (#2530) --- src/Simplex/Chat.hs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/Simplex/Chat.hs b/src/Simplex/Chat.hs index 74cf584a4f..66a896f101 100644 --- a/src/Simplex/Chat.hs +++ b/src/Simplex/Chat.hs @@ -222,25 +222,23 @@ cfgServers = \case startChatController :: forall m. ChatMonad' m => Bool -> Bool -> Bool -> m (Async ()) startChatController subConns enableExpireCIs startXFTPWorkers = do asks smpAgent >>= resumeAgentClient - users <- timeItToView "startChatController, getUsers" $ fromRight [] <$> runExceptT (withStore' getUsers) - timeItToView "startChatController, restoreCalls" $ restoreCalls + users <- fromRight [] <$> runExceptT (withStore' getUsers) + restoreCalls s <- asks agentAsync readTVarIO s >>= maybe (start s users) (pure . fst) where start s users = do - a1 <- timeItToView "startChatController, a1" $ async $ race_ notificationSubscriber agentSubscriber + a1 <- async $ race_ notificationSubscriber agentSubscriber a2 <- - timeItToView "startChatController, a2" $ - if subConns - then Just <$> async (subscribeUsers users) - else pure Nothing + if subConns + then Just <$> async (subscribeUsers users) + else pure Nothing atomically . writeTVar s $ Just (a1, a2) when startXFTPWorkers $ do - timeItToView "startChatController, startXFTP" $ startXFTP - timeItToView "startChatController, forkIO startFilesToReceive" $ void $ forkIO $ startFilesToReceive users - timeItToView "startChatController, startCleanupManager" $ startCleanupManager - when enableExpireCIs $ - timeItToView "startChatController, startExpireCIs" $ startExpireCIs users + startXFTP + void $ forkIO $ startFilesToReceive users + startCleanupManager + when enableExpireCIs $ startExpireCIs users pure a1 startXFTP = do tmp <- readTVarIO =<< asks tempDirectory