mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 13:45:36 +03:00
fix(listeners): avoid "too many listeners" problem safely (#4223)
This commit is contained in:
parent
50a6ba7fdc
commit
c97af3ee91
@ -58,6 +58,12 @@ export async function gracefullyCloseAll() {
|
|||||||
await Promise.all(Array.from(gracefullyCloseSet).map(gracefullyClose => gracefullyClose().catch(e => {})));
|
await Promise.all(Array.from(gracefullyCloseSet).map(gracefullyClose => gracefullyClose().catch(e => {})));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We currently spawn a process per page when recording video in Chromium.
|
||||||
|
// This triggers "too many listeners" on the process object once you have more than 10 pages open.
|
||||||
|
const maxListeners = process.getMaxListeners();
|
||||||
|
if (maxListeners !== 0)
|
||||||
|
process.setMaxListeners(Math.max(maxListeners || 0, 100));
|
||||||
|
|
||||||
export async function launchProcess(options: LaunchProcessOptions): Promise<LaunchResult> {
|
export async function launchProcess(options: LaunchProcessOptions): Promise<LaunchResult> {
|
||||||
const cleanup = () => helper.removeFolders(options.tempDirectories);
|
const cleanup = () => helper.removeFolders(options.tempDirectories);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user