Show resetting state after game end
This commit is contained in:
@@ -5,7 +5,7 @@ import { emit } from './bus.js';
|
||||
import type { ServerStatusEntry } from './bus.js';
|
||||
import { rconStatusResult } from '../integrations/rcon.js';
|
||||
import type { RconFailure } from '../integrations/rcon.js';
|
||||
import { listServers, setServerField } from '../fleet/servers.js';
|
||||
import { getServer, listServers, setServerField } from '../fleet/servers.js';
|
||||
import { komodoInspectHealthy } from '../integrations/komodo.js';
|
||||
import { restartSettling } from './restart-rollout.js';
|
||||
import { classifyHealth } from '../fleet/health.js';
|
||||
@@ -113,8 +113,14 @@ async function refreshStatus(): Promise<void> {
|
||||
const nextPlayers = result.status.players;
|
||||
let activeSince = srv.active_since;
|
||||
let inactiveSince = srv.inactive_since;
|
||||
const gameStartedAt = srv.game_started_at;
|
||||
const gameEndedAt = srv.game_ended_at;
|
||||
// Telemetry can arrive while the RCON request is in flight.
|
||||
const current = getServer(srv.name) ?? srv;
|
||||
const gameStartedAt = nextPlayers === 0 ? null : current.game_started_at;
|
||||
const gameEndedAt = nextPlayers === 0 ? null : current.game_ended_at;
|
||||
if (nextPlayers === 0) {
|
||||
setServerField(srv.name, 'game_started_at', null);
|
||||
setServerField(srv.name, 'game_ended_at', null);
|
||||
}
|
||||
if (nextPlayers > 0 && (activeSince === null || prevPlayers === 0 || prevPlayers === null)) {
|
||||
activeSince = now;
|
||||
inactiveSince = null;
|
||||
|
||||
Reference in New Issue
Block a user