Class ServerBoardService
Reads every server row for the operator board.
public sealed class ServerBoardService : BaseService<WorldServerEntity>, IServerBoardService
- Inheritance
-
ServerBoardService
- Implements
- Inherited Members
Remarks
Every read is unfiltered by pulse age — see the interface. The board's server rows are raw SQL so their ages are taken by the database clock (TierSql(string, bool)); the rest is EF.
Constructors
ServerBoardService(INpgsqlDbContextFactory)
public ServerBoardService(INpgsqlDbContextFactory dbContextFactory)
Parameters
dbContextFactoryINpgsqlDbContextFactory
Methods
FetchBoardAsync(CancellationToken)
Every login, world and scene server, plus the live instance count.
public Task<DatabaseResult<ServerBoardData>> FetchBoardAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
FetchPulseAgeAsync(string, string, CancellationToken)
How long ago one registered server last pulsed, in seconds by the database clock, for a health check.
public Task<DatabaseResult<double?>> FetchPulseAgeAsync(string kind, string serverName, CancellationToken cancellationToken = default)
Parameters
kindstringWhich tier:
login,worldorscene.serverNamestringThe name the server registered under, from its own configuration.
cancellationTokenCancellationTokenCancellation token.
Returns
Remarks
The pulse is a far better liveness signal than any socket probe: it proves the server is running its loop, doing work, and can still reach the database. A port probe proves a socket is bound. It is also the only signal available now that the transport is WebTransport over QUIC, which has no "is the port open" answer — a QUIC server replies only to a valid Initial packet carrying a TLS ClientHello, so a plain datagram gets nothing back.
Returns null when no server is registered under that name, which the caller must treat differently from a stale pulse: never registered and stopped talking are different faults.
An age, not the stamp. The database stamps every pulse, so the age is measured
against the database clock inside the reading statement, never negative. This used to
return last_pulse for the supervising daemon to subtract from its own
DateTime.UtcNow: a daemon host running faster than the database by more than
the stale limit saw every healthy server as silent and restarted it, over and over.
FetchScenesAsync(int?, long?, int, int, CancellationToken)
Live scene instances.
public Task<DatabaseResult<SceneInstancePage>> FetchScenesAsync(int? status, long? sceneServerId, int page, int pageSize, CancellationToken cancellationToken = default)
Parameters
statusint?Filter by
SceneStatus, or null for any.sceneServerIdlong?Filter to one scene server, or null for all.
pageint1-based page number.
pageSizeintRows per page. Clamped by the service.
cancellationTokenCancellationTokenCancellation token.