mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-08-31 20:28:22 +00:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e4f8f2ad1 | ||
|
|
f5cef2556b | ||
|
|
fef63f9083 | ||
|
|
457575f86f | ||
|
|
8647c24a95 |
+1
-1
@@ -1,7 +1,7 @@
|
||||
cabal-version: 1.12
|
||||
|
||||
name: simplexmq
|
||||
version: 6.2.1.0
|
||||
version: 6.2.1.100
|
||||
synopsis: SimpleXMQ message broker
|
||||
description: This package includes <./docs/Simplex-Messaging-Server.html server>,
|
||||
<./docs/Simplex-Messaging-Client.html client> and
|
||||
|
||||
@@ -221,13 +221,14 @@ getSMPAgentClient_ clientId cfg initServers@InitialAgentServers {smp, xftp} stor
|
||||
| backgroundMode = run c "subscriber" $ subscriber c
|
||||
| otherwise = do
|
||||
restoreServersStats c
|
||||
raceAny_
|
||||
[ run c "subscriber" $ subscriber c,
|
||||
run c "runNtfSupervisor" $ runNtfSupervisor c,
|
||||
run c "cleanupManager" $ cleanupManager c,
|
||||
run c "logServersStats" $ logServersStats c
|
||||
]
|
||||
`E.finally` saveServersStats c
|
||||
run c "subscriber" $ subscriber c
|
||||
-- raceAny_
|
||||
-- [ run c "subscriber" $ subscriber c
|
||||
-- run c "runNtfSupervisor" $ runNtfSupervisor c,
|
||||
-- run c "cleanupManager" $ cleanupManager c,
|
||||
-- run c "logServersStats" $ logServersStats c
|
||||
-- ]
|
||||
-- `E.finally` saveServersStats c
|
||||
run AgentClient {subQ, acThread} name a =
|
||||
a `E.catchAny` \e -> whenM (isJust <$> readTVarIO acThread) $ do
|
||||
logError $ "Agent thread " <> name <> " crashed: " <> tshow e
|
||||
|
||||
@@ -13,6 +13,7 @@ import Data.Time.Clock.System (systemEpochDay)
|
||||
import Data.Time.Format.ISO8601 (iso8601Show)
|
||||
import Network.Socket (ServiceName)
|
||||
import Simplex.Messaging.Server.Stats
|
||||
import Simplex.Messaging.Transport.Server (SocketStats (..))
|
||||
|
||||
data ServerMetrics = ServerMetrics
|
||||
{ statsData :: ServerStatsData,
|
||||
@@ -32,13 +33,6 @@ data RealTimeMetrics = RealTimeMetrics
|
||||
ntfSubClientsCount :: Int
|
||||
}
|
||||
|
||||
data SocketStats = SocketStats
|
||||
{ socketsAccepted :: Int,
|
||||
socketsClosed :: Int,
|
||||
socketsActive :: Int,
|
||||
socketsLeaked :: Int
|
||||
}
|
||||
|
||||
{-# FOURMOLU_DISABLE\n#-}
|
||||
prometheusMetrics :: ServerMetrics -> RealTimeMetrics -> UTCTime -> Text
|
||||
prometheusMetrics sm rtm ts =
|
||||
|
||||
@@ -12,6 +12,7 @@ module Simplex.Messaging.Transport.Server
|
||||
runTransportServerState,
|
||||
runTransportServerState_,
|
||||
SocketState,
|
||||
SocketStats (..),
|
||||
newSocketState,
|
||||
getSocketStats,
|
||||
runTransportServer,
|
||||
@@ -44,7 +45,6 @@ import Foreign.C.Error
|
||||
import GHC.IO.Exception (ioe_errno)
|
||||
import Network.Socket
|
||||
import qualified Network.TLS as T
|
||||
import Simplex.Messaging.Server.Prometheus
|
||||
import Simplex.Messaging.Transport
|
||||
import Simplex.Messaging.Util (catchAll_, labelMyThread, tshow)
|
||||
import System.Exit (exitFailure)
|
||||
@@ -165,6 +165,13 @@ safeAccept sock =
|
||||
|
||||
type SocketState = (TVar Int, TVar Int, TVar (IntMap (Weak ThreadId)))
|
||||
|
||||
data SocketStats = SocketStats
|
||||
{ socketsAccepted :: Int,
|
||||
socketsClosed :: Int,
|
||||
socketsActive :: Int,
|
||||
socketsLeaked :: Int
|
||||
}
|
||||
|
||||
newSocketState :: IO SocketState
|
||||
newSocketState = (,,) <$> newTVarIO 0 <*> newTVarIO 0 <*> newTVarIO mempty
|
||||
|
||||
|
||||
Reference in New Issue
Block a user