Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: gracefully close unused workers #30512

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 10 additions & 9 deletions packages/playwright/src/common/process.ts
Expand Up @@ -96,17 +96,18 @@ async function gracefullyCloseAndExit() {
if (closed)
return;
closed = true;
// Force exit after 30 seconds.
// eslint-disable-next-line no-restricted-properties
setTimeout(() => process.exit(0), 30000);
// Meanwhile, try to gracefully shutdown.
await processRunner?.gracefullyClose().catch(() => {});
if (processName)
await stopProfiling(processName).catch(() => {});
// eslint-disable-next-line no-restricted-properties
process.exit(0);
try {
// try to gracefully shutdown.
await processRunner?.gracefullyClose().catch(() => {});
if (processName)
await stopProfiling(processName).catch(() => {});
} finally {
// eslint-disable-next-line no-restricted-properties
process.exit(0);
}
}


function sendMessageToParent(message: { method: string, params?: any }) {
try {
process.send!(message);
Expand Down