MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / drainBrowserPool

Function drainBrowserPool

packages/engine/src/services/browserManager.ts:546–560  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

544 * that should not share browser state.
545 */
546export async function drainBrowserPool(): Promise<void> {
547 // Await any in-flight launch first — otherwise the launch resolves after we
548 // drain and produces a browser that nobody references (orphan).
549 const pending = _pooledBrowserLaunchPromise;
550 _pooledBrowserLaunchPromise = null;
551 if (pending) {
552 await pending.then((r) => r.browser.close()).catch(() => {});
553 }
554 if (pooledBrowser) {
555 const browser = pooledBrowser;
556 pooledBrowser = null;
557 pooledBrowserRefCount = 0;
558 await browser.close().catch(() => {});
559 }
560}
561
562/** Test-only: reset all pool state. */
563export function _resetBrowserPoolForTests(): void {

Callers 3

shutdownFunction · 0.85
cleanupFunction · 0.85

Calls 1

closeMethod · 0.65

Tested by

no test coverage detected