Fix transient health checks and avoid unnecessary recovery

This commit is contained in:
2026-10-02 13:06:18 -04:00
parent 221c4c10cf
commit 65d3a99846
16 changed files with 842 additions and 110 deletions
@@ -2,6 +2,8 @@ import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
import { rconStatusResult } from '$lib/server/integrations/rcon.js';
import { getServer, setServerField } from '$lib/server/fleet/servers.js';
import { latestGameSubmission } from '$lib/server/fleet/status-evidence.js';
import { isProvisioning } from '$lib/server/fleet/provisioning.js';
/**
* On-demand RCON probe for a specific server. Same code path as the periodic
@@ -18,7 +20,14 @@ export const POST: RequestHandler = async ({ params }) => {
const row = getServer(name);
if (!row) return json({ ok: false, error: `unknown server: ${name}` }, { status: 404 });
const epoch = latestGameSubmission(name);
const result = await rconStatusResult(name);
// Keep the diagnostic response, but never persist old-process evidence
// across a lifecycle request or replacement registration.
const current = getServer(name);
if (!current || current.created_at !== row.created_at || epoch !== latestGameSubmission(name) || isProvisioning(name)) {
return json(result);
}
const now = new Date().toISOString();
if (result.ok) {