feat(gateway): add channel-backed readiness probes (#38285)

* Changelog: add channel-backed readiness probe entry

* Gateway: add channel-backed readiness probes

* Docs: describe readiness probe behavior

* Gateway: add readiness probe regression tests

* Changelog: dedupe gateway probe entries

* Docs: fix readiness startup grace description

* Changelog: remove stale readiness entry

* Gateway: cover readiness hardening

* Gateway: harden readiness probes
This commit is contained in:
Vincent Koc
2026-03-06 15:15:23 -05:00
committed by GitHub
parent b17baca871
commit ab5fcfcc01
13 changed files with 558 additions and 20 deletions

View File

@@ -106,6 +106,7 @@ import {
incrementPresenceVersion,
refreshGatewayHealthSnapshot,
} from "./server/health-state.js";
import { createReadinessChecker } from "./server/readiness.js";
import { loadGatewayTlsRuntime } from "./server/tls.js";
import {
ensureGatewayStartupAuth,
@@ -546,6 +547,17 @@ export async function startGatewayServer(
if (cfgAtStart.gateway?.tls?.enabled && !gatewayTls.enabled) {
throw new Error(gatewayTls.error ?? "gateway tls: failed to enable");
}
const serverStartedAt = Date.now();
const channelManager = createChannelManager({
loadConfig,
channelLogs,
channelRuntimeEnvs,
channelRuntime: createPluginRuntime().channel,
});
const getReadiness = createReadinessChecker({
channelManager,
startedAt: serverStartedAt,
});
const {
canvasHost,
httpServer,
@@ -589,6 +601,7 @@ export async function startGatewayServer(
log,
logHooks,
logPlugins,
getReadiness,
});
let bonjourStop: (() => Promise<void>) | null = null;
const nodeRegistry = new NodeRegistry();
@@ -618,12 +631,6 @@ export async function startGatewayServer(
});
let { cron, storePath: cronStorePath } = cronState;
const channelManager = createChannelManager({
loadConfig,
channelLogs,
channelRuntimeEnvs,
channelRuntime: createPluginRuntime().channel,
});
const { getRuntimeSnapshot, startChannels, startChannel, stopChannel, markChannelLoggedOut } =
channelManager;