fix(cutover): separate api health from gateway readiness

This commit is contained in:
chick
2026-07-18 17:40:08 +08:00
parent bad00b67e9
commit f7d111588b
+3 -2
View File
@@ -72,11 +72,12 @@ function runFile(file: string, args: readonly string[]): Promise<string> {
function authenticatedReady(port: 8788 | 8790, gatewayToken: string): Promise<boolean> {
return new Promise((resolvePromise) => {
const path = port === 8790 ? '/healthz' : '/readyz';
const req = request(
{
host: '127.0.0.1',
port,
path: '/readyz',
path,
timeout: 2_000,
headers: { [GATEWAY_AUTH_HEADER]: gatewayToken },
},
@@ -364,7 +365,7 @@ export async function preflight(
): Promise<void> {
requireGatewayToken(gatewayToken);
if (!(await system.ready(8790, gatewayToken)))
throw new Error('Authenticated API readiness preflight failed on 127.0.0.1:8790/readyz');
throw new Error('Authenticated API health preflight failed on 127.0.0.1:8790/healthz');
const indexPath = join(await realpath(plan.assetDir), 'index.html');
const asset = await lstat(indexPath);
if (!asset.isFile()) throw new Error('assetDir/index.html must be a regular file');