Add active/inactive/game-time timers to fleet + server pages
Fleet cards and the per-server detail hero now show three live-ticking timers: Active (since players > 0), Inactive (since server emptied), and Game (since InitGame in games_sp.log, back-computed from the log's own MM:SS prefix so it stays accurate across restarts). Anchors are persisted on `servers` and fanned out via the SSE bus; a single 1s ticker feeds every card. Idle map cycles are filtered out so the game timer doesn't flicker.
This commit is contained in:
@@ -32,6 +32,14 @@ CREATE TABLE IF NOT EXISTS servers (
|
||||
image TEXT, -- e.g. 'ghcr.io/ayymoss/plutainer:latest'
|
||||
created_by TEXT, -- 'ui' | operator identifier
|
||||
destroyed_at TEXT, -- ISO ts when tombstoned (row usually deleted; kept as safety net)
|
||||
-- Occupancy + match timers. active_since / inactive_since are mutually
|
||||
-- exclusive: exactly one is non-null while a server is reachable. RCON
|
||||
-- outages do NOT clear either — timers survive transient unreachability
|
||||
-- and resume from the same anchor when the server comes back.
|
||||
active_since TEXT, -- ISO ts of last 0 -> >0 player transition
|
||||
inactive_since TEXT, -- ISO ts of last >0 -> 0 player transition
|
||||
game_started_at TEXT, -- ISO ts we first observed InitGame: for the current match
|
||||
game_ended_at TEXT, -- ISO ts we observed ExitLevel/ShutdownGame ending it
|
||||
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now'))
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user