diff --git a/.gitignore b/.gitignore index e645225e9..42477be20 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,4 @@ stack.yaml.lock # Temporary test files tests/tmp +logs/ diff --git a/cabal.project b/cabal.project index 5b76a9468..b3004cca1 100644 --- a/cabal.project +++ b/cabal.project @@ -5,7 +5,7 @@ constraints: zip +disable-bzip2 +disable-zstd source-repository-package type: git location: https://github.com/simplex-chat/simplexmq.git - tag: c1348aa54fba292d34339d6b111572cb1c74b546 + tag: 5f94240ed420c42c725810b72b7f512ab320a98f source-repository-package type: git diff --git a/scripts/nix/sha256map.nix b/scripts/nix/sha256map.nix index b8da2b302..25aee8630 100644 --- a/scripts/nix/sha256map.nix +++ b/scripts/nix/sha256map.nix @@ -1,5 +1,5 @@ { - "https://github.com/simplex-chat/simplexmq.git"."c1348aa54fba292d34339d6b111572cb1c74b546" = "103hw1h1agy42krf11d98bv3c1w0q0wi2z7r2ll0gmp5xv1r4rf0"; + "https://github.com/simplex-chat/simplexmq.git"."5f94240ed420c42c725810b72b7f512ab320a98f" = "194zdljlm85w97zql35ikswwpv0r5j6651bn6xqa6z7wmb5dvsxp"; "https://github.com/simplex-chat/aeson.git"."3eb66f9a68f103b5f1489382aad89f5712a64db7" = "0kilkx59fl6c3qy3kjczqvm8c3f4n3p0bdk9biyflf51ljnzp4yp"; "https://github.com/simplex-chat/haskell-terminal.git"."f708b00009b54890172068f168bf98508ffcd495" = "0zmq7lmfsk8m340g47g5963yba7i88n4afa6z93sg9px5jv1mijj"; "https://github.com/zw3rk/android-support.git"."3c3a5ab0b8b137a072c98d3d0937cbdc96918ddb" = "1r6jyxbim3dsvrmakqfyxbd6ms6miaghpbwyl0sr6dzwpgaprz97"; diff --git a/src/Simplex/Chat.hs b/src/Simplex/Chat.hs index e6a9276e1..232e60057 100644 --- a/src/Simplex/Chat.hs +++ b/src/Simplex/Chat.hs @@ -82,10 +82,8 @@ defaultChatConfig = defaultAgentConfig { tcpPort = undefined, -- agent does not listen to TCP dbFile = "simplex_v1", - dbPoolSize = 1, yesToMigrations = False }, - dbPoolSize = 1, yesToMigrations = False, defaultServers = InitialAgentServers {smp = _defaultSMPServers, ntf = _defaultNtfServers}, tbqSize = 64, diff --git a/src/Simplex/Chat/Controller.hs b/src/Simplex/Chat/Controller.hs index 321ff0e7d..dd58d5e71 100644 --- a/src/Simplex/Chat/Controller.hs +++ b/src/Simplex/Chat/Controller.hs @@ -56,7 +56,6 @@ updateStr = "To update run: curl -o- https://raw.githubusercontent.com/simplex-c data ChatConfig = ChatConfig { agentConfig :: AgentConfig, - dbPoolSize :: Int, yesToMigrations :: Bool, defaultServers :: InitialAgentServers, tbqSize :: Natural, diff --git a/src/Simplex/Chat/Core.hs b/src/Simplex/Chat/Core.hs index 6290e7f02..07bcff63e 100644 --- a/src/Simplex/Chat/Core.hs +++ b/src/Simplex/Chat/Core.hs @@ -15,7 +15,7 @@ import Simplex.Chat.Types import UnliftIO.Async simplexChatCore :: ChatConfig -> ChatOpts -> Maybe (Notification -> IO ()) -> (User -> ChatController -> IO ()) -> IO () -simplexChatCore cfg@ChatConfig {dbPoolSize, yesToMigrations} opts sendToast chat +simplexChatCore cfg@ChatConfig {yesToMigrations} opts sendToast chat | logAgent opts = do setLogLevel LogInfo -- LogError withGlobalLogging logCfg initRun @@ -23,7 +23,7 @@ simplexChatCore cfg@ChatConfig {dbPoolSize, yesToMigrations} opts sendToast chat where initRun = do let f = chatStoreFile $ dbFilePrefix opts - st <- createStore f dbPoolSize yesToMigrations + st <- createStore f yesToMigrations u <- getCreateActiveUser st cc <- newChatController st (Just u) cfg opts sendToast runSimplexChat opts u cc chat diff --git a/src/Simplex/Chat/Mobile.hs b/src/Simplex/Chat/Mobile.hs index c08966643..c8f05c4be 100644 --- a/src/Simplex/Chat/Mobile.hs +++ b/src/Simplex/Chat/Mobile.hs @@ -90,7 +90,7 @@ getActiveUser_ st = find activeUser <$> getUsers st chatInit :: String -> IO ChatController chatInit dbFilePrefix = do let f = chatStoreFile dbFilePrefix - chatStore <- createStore f (dbPoolSize defaultMobileConfig) (yesToMigrations (defaultMobileConfig :: ChatConfig)) + chatStore <- createStore f (yesToMigrations (defaultMobileConfig :: ChatConfig)) user_ <- getActiveUser_ chatStore newChatController chatStore user_ defaultMobileConfig mobileChatOpts {dbFilePrefix} Nothing diff --git a/src/Simplex/Chat/Store.hs b/src/Simplex/Chat/Store.hs index f6b4c7a1e..14a4ab61b 100644 --- a/src/Simplex/Chat/Store.hs +++ b/src/Simplex/Chat/Store.hs @@ -237,8 +237,8 @@ migrations = sortBy (compare `on` name) $ map migration schemaMigrations where migration (name, query) = Migration {name = name, up = fromQuery query} -createStore :: FilePath -> Int -> Bool -> IO SQLiteStore -createStore dbFilePath poolSize = createSQLiteStore dbFilePath poolSize migrations +createStore :: FilePath -> Bool -> IO SQLiteStore +createStore dbFilePath = createSQLiteStore dbFilePath migrations chatStoreFile :: FilePath -> FilePath chatStoreFile = (<> "_chat.db") diff --git a/stack.yaml b/stack.yaml index 009891d42..d51339fd8 100644 --- a/stack.yaml +++ b/stack.yaml @@ -49,7 +49,7 @@ extra-deps: # - simplexmq-1.0.0@sha256:34b2004728ae396e3ae449cd090ba7410781e2b3cefc59259915f4ca5daa9ea8,8561 # - ../simplexmq - github: simplex-chat/simplexmq - commit: c1348aa54fba292d34339d6b111572cb1c74b546 + commit: 5f94240ed420c42c725810b72b7f512ab320a98f # - terminal-0.2.0.0@sha256:de6770ecaae3197c66ac1f0db5a80cf5a5b1d3b64a66a05b50f442de5ad39570,2977 - github: simplex-chat/aeson commit: 3eb66f9a68f103b5f1489382aad89f5712a64db7 diff --git a/tests/ChatClient.hs b/tests/ChatClient.hs index d5a44b448..fc98aff18 100644 --- a/tests/ChatClient.hs +++ b/tests/ChatClient.hs @@ -99,14 +99,14 @@ testCfgV1 = testCfg {agentConfig = testAgentCfgV1} createTestChat :: ChatConfig -> ChatOpts -> String -> Profile -> IO TestCC createTestChat cfg opts dbPrefix profile = do let dbFilePrefix = testDBPrefix <> dbPrefix - st <- createStore (dbFilePrefix <> "_chat.db") 1 False + st <- createStore (dbFilePrefix <> "_chat.db") False Right user <- runExceptT $ createUser st profile True startTestChat_ st cfg opts dbFilePrefix user startTestChat :: ChatConfig -> ChatOpts -> String -> IO TestCC startTestChat cfg opts dbPrefix = do let dbFilePrefix = testDBPrefix <> dbPrefix - st <- createStore (dbFilePrefix <> "_chat.db") 1 False + st <- createStore (dbFilePrefix <> "_chat.db") False Just user <- find activeUser <$> getUsers st startTestChat_ st cfg opts dbFilePrefix user @@ -262,6 +262,7 @@ serverCfg = queueIdBytes = 12, msgIdBytes = 6, storeLogFile = Nothing, + storeMsgsFile = Nothing, allowNewQueues = True, messageExpiration = Just defaultMessageExpiration, inactiveClientExpiration = Just defaultInactiveClientExpiration, diff --git a/tests/ChatTests.hs b/tests/ChatTests.hs index 124f866e9..6a01223d1 100644 --- a/tests/ChatTests.hs +++ b/tests/ChatTests.hs @@ -2171,6 +2171,7 @@ testMaintenanceModeWithFiles = withTmpFiles $ do alice <## "completed receiving file 1 (test.jpg) from bob" src <- B.readFile "./tests/fixtures/test.jpg" B.readFile "./tests/tmp/alice_files/test.jpg" `shouldReturn` src + threadDelay 500000 alice ##> "/_stop" alice <## "chat stopped" alice ##> "/_db export {\"archivePath\": \"./tests/tmp/alice-chat.zip\"}" diff --git a/tests/MobileTests.hs b/tests/MobileTests.hs index 399636521..8573d0049 100644 --- a/tests/MobileTests.hs +++ b/tests/MobileTests.hs @@ -82,7 +82,7 @@ testChatApiNoUser = withTmpFiles $ do testChatApi :: IO () testChatApi = withTmpFiles $ do let f = chatStoreFile $ testDBPrefix <> "1" - st <- createStore f 1 True + st <- createStore f True Right _ <- runExceptT $ createUser st aliceProfile True cc <- chatInit $ testDBPrefix <> "1" chatSendCmd cc "/u" `shouldReturn` activeUser diff --git a/tests/SchemaDump.hs b/tests/SchemaDump.hs index 03ef2a47d..a876b10af 100644 --- a/tests/SchemaDump.hs +++ b/tests/SchemaDump.hs @@ -21,7 +21,7 @@ schemaDumpTest = testVerifySchemaDump :: IO () testVerifySchemaDump = withTmpFiles $ do - void $ createStore testDB 1 False + void $ createStore testDB False void $ readCreateProcess (shell $ "touch " <> schema) "" savedSchema <- readFile schema savedSchema `seq` pure ()