Skip to content

Commit

Permalink
Reduce default timeout from 1000ms to 100ms, use 10ms in graceful-shu…
Browse files Browse the repository at this point in the history
…tdown test
  • Loading branch information
bgw committed Aug 3, 2024
1 parent 6935a2e commit dce1ebb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/next/src/cli/next-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ let sessionStarted = Date.now()

// How long should we wait for the child to cleanly exit after sending
// SIGINT/SIGTERM to the child process before sending SIGKILL?
const CHILD_EXIT_TIMEOUT_MS = 1000
const CHILD_EXIT_TIMEOUT_MS = parseInt(
process.env.NEXT_EXIT_TIMEOUT_MS ?? '100',
10
)

const handleSessionStop = async (signal: NodeJS.Signals | number | null) => {
if (signal != null && child?.pid) child.kill(signal)
Expand Down
6 changes: 5 additions & 1 deletion test/production/graceful-shutdown/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ describe('Graceful Shutdown', () => {
app = await initNextServerScript(
serverFile,
/- Local:/,
{ ...process.env, PORT: appPort.toString() },
{
...process.env,
NEXT_EXIT_TIMEOUT_MS: '10',
PORT: appPort.toString(),
},
undefined,
{ cwd: next.testDir }
)
Expand Down

0 comments on commit dce1ebb

Please sign in to comment.