From d5f6b76ec5bf11193ffaaf3a26b8a1f37cbec0d6 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Sun, 26 Feb 2023 16:36:11 +0000 Subject: [PATCH] core: increase default queue sizes to 1024, fix broadcast bot not to lock when queue is smaller than the number of contacts (#1955) --- apps/simplex-broadcast-bot/Main.hs | 3 ++- src/Simplex/Chat.hs | 1 - src/Simplex/Chat/Controller.hs | 1 - src/Simplex/Chat/Mobile.hs | 2 +- src/Simplex/Chat/Options.hs | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/apps/simplex-broadcast-bot/Main.hs b/apps/simplex-broadcast-bot/Main.hs index 3a42b21e6..d2cd5edd3 100644 --- a/apps/simplex-broadcast-bot/Main.hs +++ b/apps/simplex-broadcast-bot/Main.hs @@ -6,6 +6,7 @@ module Main where +import Control.Concurrent (forkIO) import Control.Concurrent.Async import Control.Concurrent.STM import Control.Monad.Reader @@ -48,7 +49,7 @@ broadcastBot BroadcastBotOpts {publishers, welcomeMessage, prohibitedMessage} _u if allowContent mc then do sendChatCmd cc "/contacts" >>= \case - CRContactsList _ cts -> do + CRContactsList _ cts -> void . forkIO $ do let cts' = filter broadcastTo cts forM_ cts' $ \ct' -> sendComposedMessage cc ct' Nothing mc sendReply $ "Forwarded to " <> show (length cts') <> " contact(s)" diff --git a/src/Simplex/Chat.hs b/src/Simplex/Chat.hs index 363371af8..131aaedf8 100644 --- a/src/Simplex/Chat.hs +++ b/src/Simplex/Chat.hs @@ -105,7 +105,6 @@ defaultChatConfig = fileChunkSize = 15780, -- do not change inlineFiles = defaultInlineFilesConfig, logLevel = CLLImportant, - subscriptionConcurrency = 16, subscriptionEvents = False, hostEvents = False, testView = False, diff --git a/src/Simplex/Chat/Controller.hs b/src/Simplex/Chat/Controller.hs index 70240aff7..fb9f10564 100644 --- a/src/Simplex/Chat/Controller.hs +++ b/src/Simplex/Chat/Controller.hs @@ -105,7 +105,6 @@ data ChatConfig = ChatConfig tbqSize :: Natural, fileChunkSize :: Integer, inlineFiles :: InlineFilesConfig, - subscriptionConcurrency :: Int, subscriptionEvents :: Bool, hostEvents :: Bool, logLevel :: ChatLogLevel, diff --git a/src/Simplex/Chat/Mobile.hs b/src/Simplex/Chat/Mobile.hs index 96dadf9c8..6820d3c1f 100644 --- a/src/Simplex/Chat/Mobile.hs +++ b/src/Simplex/Chat/Mobile.hs @@ -135,7 +135,7 @@ mobileChatOpts dbFilePrefix dbKey = logConnections = False, logServerHosts = True, logAgent = False, - tbqSize = 64 + tbqSize = 1024 }, chatCmd = "", chatCmdDelay = 3, diff --git a/src/Simplex/Chat/Options.hs b/src/Simplex/Chat/Options.hs index 749c90c1d..63ff7e1b2 100644 --- a/src/Simplex/Chat/Options.hs +++ b/src/Simplex/Chat/Options.hs @@ -132,7 +132,7 @@ coreChatOptsP appDir defaultDbFileName = do <> short 'q' <> metavar "SIZE" <> help "Internal queue size" - <> value 64 + <> value 1024 <> showDefault ) pure