Class PulseHealthChecker
- Namespace
- AppHealthMonitor
- Assembly
- AppHealthMonitor.dll
Checks a FishMMO game server by reading the pulse it writes to the database.
public sealed class PulseHealthChecker : IHealthChecker
- Inheritance
-
PulseHealthChecker
- Implements
- Inherited Members
Remarks
The transport is WebTransport over QUIC, which is UDP only. There is no TCP listener on a game port, so a TCP check fails against a perfectly healthy server and the supervisor restarts it until it gives up — and a UDP check cannot replace it, because a UDP send succeeds whether or not anything is listening. QUIC has no cheap "is the port open" answer either: the server replies only to a valid Initial packet carrying a TLS ClientHello, so a real probe means performing a handshake with the native msquic library on every host.
The pulse avoids all of that and proves strictly more. A socket probe shows a socket is bound; the pulse shows the server is running its loop, doing work, and can still reach the database.
Constructors
PulseHealthChecker(IServerBoardService, string, string, int)
Creates a checker for one registered server.
public PulseHealthChecker(IServerBoardService board, string tier, string serverName, int staleSeconds)
Parameters
boardIServerBoardServiceThe read service.
tierstringlogin, world or scene.
serverNamestringThe name the server registers under, from its own configuration.
staleSecondsintHow old a pulse may be before the server counts as down.
Fields
DefaultTimeoutMs
How long a database round trip is allowed before it counts as no answer.
public const int DefaultTimeoutMs = 5000
Field Value
Properties
PortType
Gets the port type this health checker handles.
public PortType PortType { get; }
Property Value
Methods
IsResponsiveAsync(string, int, int, CancellationToken)
Reports whether the server's pulse is recent.
public Task<bool> IsResponsiveAsync(string host, int port, int timeoutMilliseconds, CancellationToken cancellationToken)
Parameters
hoststringportinttimeoutMillisecondsintcancellationTokenCancellationToken
Returns
Remarks
This check fails OPEN. If the database cannot be read, it returns healthy and logs loudly. That is deliberate and it is the most important decision in this file.
Treating an unreadable database as "unhealthy" would mean that during a database outage every pulse looks stale at once, on every host, and every daemon restarts every server simultaneously — turning a recoverable outage into a shard-wide one, at the exact moment nobody can afford it. The distinction that matters is between knowing a server is silent and not knowing anything, and only the first is grounds for killing a process.
The cost is real and worth stating: during a database outage a genuinely dead server will not be caught. That is the better half of the trade.
The host and port arguments are ignored. This
check does not reach the network, which is the entire point of it.