🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix: increase web container shutdown timeout (#2637)
Max Deichmann2a68c0610b78
diff --git a/web/src/pages/api/public/health.ts b/web/src/pages/api/public/health.tsindex 3a8bf838a1..859747cf01 100644--- a/web/src/pages/api/public/health.ts+++ b/web/src/pages/api/public/health.ts@@ -17,7 +17,7 @@ export default async function handler(try {if (isSigtermReceived()) {console.log(- "Health check failed: SIGTERM / SIGINT received, shutting down",+ "Health check failed: SIGTERM / SIGINT received, shutting down.",);return res.status(500).json({status: "SIGTERM / SIGINT received, shutting down",diff --git a/web/src/utils/shutdown.ts b/web/src/utils/shutdown.tsindex 308799eb32..50c7c28f33 100644--- a/web/src/utils/shutdown.ts+++ b/web/src/utils/shutdown.ts@@ -4,6 +4,8 @@// NEVER call process.exit() in this process. Kubernetes should kill the container: https://kostasbariotis.com/why-you-should-not-use-process-exit/// We wait for 20 seconds to allow the app to finish processing requests. There is no native way to do this in Next.js.+const TIMEOUT = 120_000;+declare global {// eslint-disable-next-line no-varvar sigtermReceived: boolean | undefined;@@ -21,14 +23,16 @@ export const isSigtermReceived = () =>export const shutdown = async (signal: PrexitSignal) => {if (signal === "SIGTERM" || signal === "SIGINT") {- console.log("SIGTERM / SIGINT received. Shutting down in 20 seconds.");+ console.log(+ `SIGTERM / SIGINT received. Shutting down in ${TIMEOUT / 1000} seconds.`,+ );setSigtermReceived();return await new Promise<void>((resolve) => {setTimeout(() => {console.log("Shutdown complete");resolve();- }, 20000);+ }, TIMEOUT);});}};