mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-10-22 21:52:51 +00:00
smp server: optionally append store log with postgres storage (without loading and compacting, for debugging during migration) (#1480)
* smp server: optionally maintain store log with postgres storage (without loading and compacting, for debugging during migration) * refactor * remove comment
This commit is contained in:
1 parent
d44f09d111
commit
019a32a623
10 files changed
+151
-100
No files matched your search
@@ -158,9 +158,9 @@ instance StrEncoding StoreLogRecord where
|
||||
DeleteNotifier_ -> DeleteNotifier <$> strP
|
||||
UpdateTime_ -> UpdateTime <$> strP_ <*> strP
|
||||
|
||||
openWriteStoreLog :: FilePath -> IO (StoreLog 'WriteMode)
|
||||
openWriteStoreLog f = do
|
||||
h <- openFile f WriteMode
|
||||
openWriteStoreLog :: Bool -> FilePath -> IO (StoreLog 'WriteMode)
|
||||
openWriteStoreLog append f = do
|
||||
h <- openFile f $ if append then AppendMode else WriteMode
|
||||
hSetBuffering h LineBuffering
|
||||
pure $ WriteStoreLog f h
|
||||
|
||||
@@ -239,7 +239,7 @@ readWriteStoreLog readStore writeStore f st =
|
||||
removeStoreLogBackups f
|
||||
pure s
|
||||
writeLog msg = do
|
||||
s <- openWriteStoreLog f
|
||||
s <- openWriteStoreLog False f
|
||||
logInfo msg
|
||||
writeStore s st
|
||||
pure s
|
||||
|
||||
Reference in new issue
Block a user