From 274049f8cf610ecfed7b223e767f00407691c5e8 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Mon, 27 Oct 2025 12:16:10 +0100 Subject: [PATCH] Use os.availableParallelism() instead of os.cpus().length * As https://nodejs.org/api/os.html#oscpus says: os.cpus().length should not be used to calculate the amount of parallelism available to an application. Use os.availableParallelism() for this purpose. --- bundler.js | 2 +- dist/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bundler.js b/bundler.js index 4d96bdd..b4f344c 100644 --- a/bundler.js +++ b/bundler.js @@ -195,7 +195,7 @@ export async function bundleInstall(gemfile, lockFile, platform, engine, rubyVer } // Number of jobs should scale with runner, up to a point - const jobs = Math.min(os.cpus().length, 8) + const jobs = Math.min(os.availableParallelism(), 8) // Always run 'bundle install' to list the gems await exec.exec('bundle', ['install', '--jobs', jobs]) diff --git a/dist/index.js b/dist/index.js index 3b0e557..934a1cd 100644 --- a/dist/index.js +++ b/dist/index.js @@ -209,7 +209,7 @@ async function bundleInstall(gemfile, lockFile, platform, engine, rubyVersion, b } // Number of jobs should scale with runner, up to a point - const jobs = Math.min(os.cpus().length, 8) + const jobs = Math.min(os.availableParallelism(), 8) // Always run 'bundle install' to list the gems await exec.exec('bundle', ['install', '--jobs', jobs])