Skip to content

Commit

Permalink
fix: gracefullyClose unused workers
Browse files Browse the repository at this point in the history
This patch fixes issue microsoft#30504 by gracefully terminating the worker before exiting the process
  • Loading branch information
NoamGaash committed Apr 24, 2024
1 parent 1fecc20 commit 397b8de
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/playwright-test/src/common/process.ts
Expand Up @@ -90,12 +90,13 @@ async function gracefullyCloseAndExit() {
if (closed)
return;
closed = true;
// Force exit after 30 seconds.
setTimeout(() => process.exit(0), 30000);
// Meanwhile, try to gracefully shutdown.
await processRunner.gracefullyClose().catch(() => {});
await stopProfiling(processName).catch(() => {});
process.exit(0);
try {
// try to gracefully shutdown.
await processRunner.gracefullyClose().catch(() => {});
await stopProfiling(processName).catch(() => {});
} finally {
process.exit(0);
}
}

function sendMessageToParent(message: { method: string, params?: any }) {
Expand Down

0 comments on commit 397b8de

Please sign in to comment.