core: increase default queue sizes to 1024, fix broadcast bot not to lock when queue is smaller than the number of contacts (#1955)

This commit is contained in:
Evgeny Poberezkin 2023-02-26 16:36:11 +00:00 committed by GitHub
parent ae75be56ea
commit d5f6b76ec5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 4 additions and 5 deletions

View File

@ -6,6 +6,7 @@
module Main where module Main where
import Control.Concurrent (forkIO)
import Control.Concurrent.Async import Control.Concurrent.Async
import Control.Concurrent.STM import Control.Concurrent.STM
import Control.Monad.Reader import Control.Monad.Reader
@ -48,7 +49,7 @@ broadcastBot BroadcastBotOpts {publishers, welcomeMessage, prohibitedMessage} _u
if allowContent mc if allowContent mc
then do then do
sendChatCmd cc "/contacts" >>= \case sendChatCmd cc "/contacts" >>= \case
CRContactsList _ cts -> do CRContactsList _ cts -> void . forkIO $ do
let cts' = filter broadcastTo cts let cts' = filter broadcastTo cts
forM_ cts' $ \ct' -> sendComposedMessage cc ct' Nothing mc forM_ cts' $ \ct' -> sendComposedMessage cc ct' Nothing mc
sendReply $ "Forwarded to " <> show (length cts') <> " contact(s)" sendReply $ "Forwarded to " <> show (length cts') <> " contact(s)"

View File

@ -105,7 +105,6 @@ defaultChatConfig =
fileChunkSize = 15780, -- do not change fileChunkSize = 15780, -- do not change
inlineFiles = defaultInlineFilesConfig, inlineFiles = defaultInlineFilesConfig,
logLevel = CLLImportant, logLevel = CLLImportant,
subscriptionConcurrency = 16,
subscriptionEvents = False, subscriptionEvents = False,
hostEvents = False, hostEvents = False,
testView = False, testView = False,

View File

@ -105,7 +105,6 @@ data ChatConfig = ChatConfig
tbqSize :: Natural, tbqSize :: Natural,
fileChunkSize :: Integer, fileChunkSize :: Integer,
inlineFiles :: InlineFilesConfig, inlineFiles :: InlineFilesConfig,
subscriptionConcurrency :: Int,
subscriptionEvents :: Bool, subscriptionEvents :: Bool,
hostEvents :: Bool, hostEvents :: Bool,
logLevel :: ChatLogLevel, logLevel :: ChatLogLevel,

View File

@ -135,7 +135,7 @@ mobileChatOpts dbFilePrefix dbKey =
logConnections = False, logConnections = False,
logServerHosts = True, logServerHosts = True,
logAgent = False, logAgent = False,
tbqSize = 64 tbqSize = 1024
}, },
chatCmd = "", chatCmd = "",
chatCmdDelay = 3, chatCmdDelay = 3,

View File

@ -132,7 +132,7 @@ coreChatOptsP appDir defaultDbFileName = do
<> short 'q' <> short 'q'
<> metavar "SIZE" <> metavar "SIZE"
<> help "Internal queue size" <> help "Internal queue size"
<> value 64 <> value 1024
<> showDefault <> showDefault
) )
pure pure