mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-12 17:45:49 +08:00
[formatter] Utilize available CPU cores.
Drive-by-fix: Use uppercase naming for constants as per the JavaScript style guide. Change-Id: I7b9adb7ec1067ab79319d79dd68668a53bf29f46 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2514437 Reviewed-by: Paul Lewis <aerotwist@chromium.org> Commit-Queue: Paul Lewis <aerotwist@chromium.org> Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
This commit is contained in:
committed by
Commit Bot
parent
c25cf447b9
commit
7c769fe9fa
@@ -4,7 +4,7 @@
|
||||
|
||||
import * as Common from '../common/common.js';
|
||||
|
||||
const MaxWorkers = 2;
|
||||
const MAX_WORKERS = Math.min(2, navigator.hardwareConcurrency - 1);
|
||||
|
||||
/** @type {!FormatterWorkerPool} */
|
||||
let formatterWorkerPoolInstance;
|
||||
@@ -47,7 +47,7 @@ export class FormatterWorkerPool {
|
||||
}
|
||||
|
||||
let freeWorker = [...this._workerTasks.keys()].find(worker => !this._workerTasks.get(worker));
|
||||
if (!freeWorker && this._workerTasks.size < MaxWorkers) {
|
||||
if (!freeWorker && this._workerTasks.size < MAX_WORKERS) {
|
||||
freeWorker = this._createWorker();
|
||||
}
|
||||
if (!freeWorker) {
|
||||
|
||||
Reference in New Issue
Block a user