mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-03-29 10:10:06 +00:00
Merge branch 'master' into ep/disable-background
This commit is contained in:
@@ -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