From 7ed86689ebc82bbcd1d6cc6840389cb850ae4c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Mon, 4 Jul 2022 09:22:08 -0400 Subject: [PATCH 1/2] fix: update build worker numbers --- Gulpfile.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Gulpfile.mjs b/Gulpfile.mjs index 8560537a78ac..e04e2943b8fd 100644 --- a/Gulpfile.mjs +++ b/Gulpfile.mjs @@ -1,5 +1,6 @@ import path from "path"; import fs from "fs"; +import { cpus } from "os"; import { createRequire } from "module"; import { fileURLToPath } from "url"; import plumber from "gulp-plumber"; @@ -222,7 +223,8 @@ function getFiles(glob, { include, exclude }) { } function createWorker(useWorker) { - const numWorkers = require("os").cpus().length / 2 - 1; + // jest-worker defaults + const numWorkers = cpus().length - 1; if (numWorkers === 0 || !useWorker) { return require("./babel-worker.cjs"); } From 18144942cf484d1a127df9be98b3a686eb34d4de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Mon, 4 Jul 2022 10:00:26 -0400 Subject: [PATCH 2/2] address review comment --- Gulpfile.mjs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Gulpfile.mjs b/Gulpfile.mjs index e04e2943b8fd..bcea77b71ec5 100644 --- a/Gulpfile.mjs +++ b/Gulpfile.mjs @@ -223,8 +223,7 @@ function getFiles(glob, { include, exclude }) { } function createWorker(useWorker) { - // jest-worker defaults - const numWorkers = cpus().length - 1; + const numWorkers = Math.ceil(cpus().length / 2) - 1; if (numWorkers === 0 || !useWorker) { return require("./babel-worker.cjs"); }