Skip to content

Commit

Permalink
feat(core): add config to skip waiting for browser close (#120)
Browse files Browse the repository at this point in the history
Summary:
Issue: #95

Pull Request resolved: #120

Test Plan:
```
memlab build-core && memlab test && arc lint
```

Reviewed By: twobassdrum

Differential Revision: D57819075

Pulled By: JacksonGL

fbshipit-source-id: e60d1aa9d8b59565534a660bb029ceb68499b3d6
  • Loading branch information
Eryk Kolodziej authored and facebook-github-bot committed May 28, 2024
1 parent da1e05c commit 3024612
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/core/src/lib/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ export class MemLabConfig {
noReCluster: boolean;
maxSamplesForClustering: number;
filterTraceByName: Nullable<string>;
skipBrowserCloseWait: boolean;

constructor(options: ConfigOption = {}) {
// init properties, they can be configured manually
Expand Down Expand Up @@ -370,6 +371,8 @@ export class MemLabConfig {
// if specified via CLI options, this will filter leak traces by
// node and edge names in the leak trace
this.filterTraceByName = null;
// if true, memlab will not wait for the browser to close successfully
this.skipBrowserCloseWait = false;
}

// initialize configurable parameters
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/lib/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1325,6 +1325,8 @@ async function closePuppeteer(
if (config.isLocalPuppeteer && !options.warmup) {
await Promise.all(pages.map(page => page.close()));
await browser.disconnect();
} else if (config.skipBrowserCloseWait) {
browser.close();
} else {
await browser.close();
}
Expand Down

0 comments on commit 3024612

Please sign in to comment.