Skip to content

Commit 00454db

Browse files
committed
feat: support SERVER_SHUTDOWN_TIMEOUT and SERVER_FORCE_SHUTDOWN_TIMEOUT env variables
1 parent 51dbad2 commit 00454db

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/_plugins.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ export const gracefulShutdownPlugin: ServerPlugin = (server) => {
2626
return;
2727
}
2828
const gracefulShutdown =
29-
config === true || !config?.gracefulTimeout ? 3 : config.gracefulTimeout;
29+
config === true || !config?.gracefulTimeout
30+
? Number.parseInt(process.env.SERVER_SHUTDOWN_TIMEOUT || "") || 3
31+
: config.gracefulTimeout;
3032
const forceShutdown =
31-
config === true || !config?.forceTimeout ? 3 : config.forceTimeout;
33+
config === true || !config?.forceTimeout
34+
? Number.parseInt(process.env.SERVER_FORCE_SHUTDOWN_TIMEOUT || "") || 5
35+
: config.forceTimeout;
3236
let isShuttingDown = false;
3337
const shutdown = async () => {
3438
if (isShuttingDown) return;

0 commit comments

Comments
 (0)