统一 Node 22 与后端安全运行基线(07-15-production-trust-closeout-cleanup)

这个提交包含在:
2026-07-16 05:17:18 +08:00
父节点 dcf34d7ac6
当前提交 abb6a22f5c
共修改 28 个文件,包含 2250 行新增和 3012 行删除
+20 -5
查看文件
@@ -1,7 +1,7 @@
require("dotenv/config");
const { getConfig } = require("./config");
const { initTracing } = require("./observability/tracing");
const { initTracing, shutdownTracing } = require("./observability/tracing");
const config = getConfig();
initTracing(config);
@@ -35,22 +35,37 @@ async function main() {
}, timeoutMs);
forceTimer.unref?.();
let exitCode = 0;
try {
await app.close();
app.log.info("Graceful shutdown completed");
process.exit(0);
} catch (error) {
app.log.error({ err: error }, "Graceful shutdown failed");
process.exit(1);
exitCode = 1;
}
try {
await shutdownTracing();
} catch (error) {
app.log.error({ err: error }, "OTel shutdown failed");
exitCode = 1;
}
clearTimeout(forceTimer);
app.log.info({ exitCode }, "Graceful shutdown completed");
process.exit(exitCode);
};
process.on("SIGTERM", () => shutdown("SIGTERM"));
process.on("SIGINT", () => shutdown("SIGINT"));
}
main().catch((err) => {
main().catch(async (err) => {
// eslint-disable-next-line no-console
console.error(err);
try {
await shutdownTracing();
} catch {
// The startup error remains authoritative; shutdown is best effort here.
}
process.exit(1);
});