fix: align api keepalive with gateway pool

This commit is contained in:
hectorzhao
2026-08-25 17:35:18 +08:00
parent 76e7c8c401
commit 394949f9f6
8 changed files with 64 additions and 1 deletions
+3 -1
View File
@@ -7,6 +7,7 @@ import { AppModule } from './app.module';
import { MetricsService } from './metrics/metrics.service';
import { OpenApiModule } from './open-api/open-api.module';
import { configureHttpBodyParsers } from './http-body-limits';
import { configureApiHttpServerTimeouts } from './http-server-timeouts';
Object.defineProperty(BigInt.prototype, 'toJSON', {
configurable: true,
@@ -43,7 +44,8 @@ async function bootstrap() {
const port = Number(process.env.API_PORT ?? 3000);
// 生产环境只允许 Nginx 访问管理 API;显式绑定回环,避免默认的全网卡监听绕过入口鉴权与限流。
const host = process.env.API_HOST?.trim() || '127.0.0.1';
await app.listen(port, host);
const apiServer = await app.listen(port, host);
configureApiHttpServerTimeouts(apiServer, process.env);
const metrics = app.get(MetricsService);
const metricsHost = process.env.API_METRICS_HOST?.trim() || '127.0.0.1';