Use database fleet registry and gate RCON polling on container readiness
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
export type Health = 'online' | 'stale' | 'offline';
|
||||
export type Health = 'online' | 'stale' | 'offline' | 'starting';
|
||||
|
||||
const ONLINE_MAX_MS = 30_000;
|
||||
const STALE_MAX_MS = 120_000;
|
||||
@@ -9,7 +9,9 @@ const STALE_MAX_MS = 120_000;
|
||||
* successful reply is >120s old. `stale` if the last reply is 30-120s old
|
||||
* (RCON glitchy). `online` if fresh.
|
||||
*/
|
||||
export function classifyHealth(lastSeenAt: string | null, lastError: string | null): Health {
|
||||
export function classifyHealth(lastSeenAt: string | null, lastError: string | null, containerState?: string | null): Health {
|
||||
if (containerState === 'starting' || containerState === 'restarting') return 'starting';
|
||||
if (containerState && containerState !== 'running') return 'offline';
|
||||
if (!lastSeenAt) return 'offline';
|
||||
const age = Date.now() - new Date(lastSeenAt).getTime();
|
||||
if (!Number.isFinite(age) || age < 0) return 'offline';
|
||||
|
||||
Reference in New Issue
Block a user