INNER CODE UNIT · TypeScript
formatTime
SveltyCMS/SveltyCMS · scripts/benchmark-matrix/index.ts:389
function formatTime(seconds: number): string {
if (seconds < 60) return `${Math.round(seconds)}s`;
const m = Math.floor(seconds / 60);
const s = Math.round(seconds % 60);
return `${m}m ${s}s`;
}
function isHealthReady(data: Record<string, unknown>): boolean {
const status = String(data.overallStatus ?? data.status ?? "").toUpperCase();
const db = data.database;
const dbOk = db === true || db === "connected";
const readyStates = new Set(["READY", "WARMED", "DEGRADED"]);
// 🔴 READINESS TRUTHFULNESS (2026-09-28): `overallStatus` alone let a server
// that was still warming its boot cache count as ready, so every benchmark leg
// measured the warm-up itself. The server now reports a strict `ready` flag
// (DB connected AND the boot pre-warm settled); require it when present —
// `undefined` keeps older builds runnable.
return readyStates.has(status) && dbOk && data.ready !== false;