Gateway: lazily resolve channel runtime

This commit is contained in:
Vincent Koc
2026-03-16 01:41:14 -07:00
parent 77b1f240fd
commit 776e5d8a08
2 changed files with 24 additions and 3 deletions

View File

@@ -138,6 +138,13 @@ const logDiscovery = log.child("discovery");
const logTailscale = log.child("tailscale");
const logChannels = log.child("channels");
const logBrowser = log.child("browser");
let cachedChannelRuntime: ReturnType<typeof createPluginRuntime>["channel"] | null = null;
function getChannelRuntime() {
cachedChannelRuntime ??= createPluginRuntime().channel;
return cachedChannelRuntime;
}
const logHealth = log.child("health");
const logCron = log.child("cron");
const logReload = log.child("reload");
@@ -575,7 +582,7 @@ export async function startGatewayServer(
loadConfig,
channelLogs,
channelRuntimeEnvs,
channelRuntime: createPluginRuntime().channel,
resolveChannelRuntime: getChannelRuntime,
});
const getReadiness = createReadinessChecker({
channelManager,