DEV: JOBS should be cap at 2 in assets:precompile:build (#28834)

This fixes a mistake I introduced in
b652f66378. I wanted to cap it at 2 not 4.
This commit is contained in:
Alan Guo Xiang Tan 2024-09-11 08:18:42 +08:00 committed by GitHub
parent 9b465e1914
commit 279ffb3351
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,9 +13,9 @@ task "assets:precompile:build" do
raise "Unknown ember version '#{ember_version}'" if !%w[5].include?(ember_version)
# If `JOBS` env is not set, `thread-loader` defaults to the number of CPUs - 1 on the machine but we want to cap it
# at 4 because benchmarking has shown that anything beyond 4 does not improve build times or the increase is marginal.
# at 2 because benchmarking has shown that anything beyond 2 does not improve build times or the increase is marginal.
# Therefore, we cap it so that we don't spawn more processes than necessary.
jobs_env_count = (4 if !ENV["JOBS"].present? && Etc.nprocessors > 4)
jobs_env_count = (2 if !ENV["JOBS"].present? && Etc.nprocessors > 2)
compile_command = "CI=1 pnpm --dir=app/assets/javascripts/discourse ember build"