fix: align api keepalive with gateway pool
This commit is contained in:
@@ -4,6 +4,7 @@ import { resolve } from 'node:path';
|
||||
const deploy = readFileSync(resolve(import.meta.dirname, 'production-deploy.sh'), 'utf8');
|
||||
const bootstrap = readFileSync(resolve(import.meta.dirname, 'production-bootstrap.sh'), 'utf8');
|
||||
const apiMain = readFileSync(resolve(import.meta.dirname, '../../api/src/main.ts'), 'utf8');
|
||||
const apiTimeouts = readFileSync(resolve(import.meta.dirname, '../../api/src/http-server-timeouts.ts'), 'utf8');
|
||||
const workerMain = readFileSync(resolve(import.meta.dirname, '../../api/src/send-worker.ts'), 'utf8');
|
||||
const required = [
|
||||
'compression_config=/etc/nginx/conf.d/cmpp-compression.conf',
|
||||
@@ -26,6 +27,14 @@ for (const marker of ['API_HOST="${API_HOST:-127.0.0.1}"', 'API_HOST=${API_HOST}
|
||||
if (!apiMain.includes("process.env.API_HOST?.trim() || '127.0.0.1'") || !apiMain.includes('app.listen(port, host)')) {
|
||||
throw new Error('NestJS API must bind to API_HOST and default to loopback');
|
||||
}
|
||||
for (const marker of ['API_HTTP_KEEP_ALIVE_TIMEOUT_MS', 'API_HTTP_HEADERS_TIMEOUT_MS']) {
|
||||
if (!`${deploy}\n${bootstrap}\n${apiTimeouts}`.includes(marker)) {
|
||||
throw new Error(`production deployment is missing the API keep-alive contract: ${marker}`);
|
||||
}
|
||||
}
|
||||
if (!apiMain.includes('configureApiHttpServerTimeouts(apiServer, process.env)')) {
|
||||
throw new Error('NestJS API must apply the explicit keep-alive contract to its HTTP server');
|
||||
}
|
||||
|
||||
for (const marker of [
|
||||
'CMPP_INBOUND_FAST_PATH_ENABLED=true',
|
||||
|
||||
Reference in New Issue
Block a user