mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-11-04 08:37:49 +00:00
debug
This commit is contained in:
1 parent
73d0013a8a
commit
7e06d55ff5
1 file changed
+21
@@ -63,11 +63,18 @@ import PostgresSchemaDump (postgresSchemaDumpTest)
|
||||
import SMPClient (postgressBracket)
|
||||
#endif
|
||||
|
||||
#if MIN_VERSION_base(4,18,0)
|
||||
import Control.Concurrent (forkIO, threadDelay)
|
||||
import Control.Monad (forM_, void)
|
||||
import GHC.Conc.Sync (listThreads, threadLabel, threadStatus)
|
||||
#endif
|
||||
|
||||
logCfg :: LogConfig
|
||||
logCfg = LogConfig {lc_file = Nothing, lc_stderr = True}
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
dumpThreadsAfter 25
|
||||
setLogLevel testLogLevel
|
||||
withGlobalLogging logCfg $ do
|
||||
setEnv "APNS_KEY_ID" "H82WD9K9AQ"
|
||||
@@ -196,6 +203,20 @@ main = do
|
||||
describe "Agent SQLite schema dump" schemaDumpTest
|
||||
#endif
|
||||
|
||||
dumpThreadsAfter :: Int -> IO ()
|
||||
#if MIN_VERSION_base(4,18,0)
|
||||
dumpThreadsAfter minutes = void . forkIO $ do
|
||||
threadDelay $ minutes * 60000000
|
||||
ts <- listThreads
|
||||
putStrLn $ "=== " <> show (length ts) <> " threads after " <> show minutes <> " minutes"
|
||||
forM_ ts $ \t -> do
|
||||
s <- threadStatus t
|
||||
l <- threadLabel t
|
||||
putStrLn $ show t <> " " <> show s <> " " <> maybe "" id l
|
||||
#else
|
||||
dumpThreadsAfter _ = pure ()
|
||||
#endif
|
||||
|
||||
hspecInTmpDir :: Spec -> IO ()
|
||||
hspecInTmpDir spec = do
|
||||
(config, forest) <- evalSpec defaultConfig spec
|
||||
|
||||
Reference in new issue
Block a user