Skip to content

Commit acf4dc5

Browse files
chore(internal): bound formatter parallelism to CPU count
1 parent 0d84634 commit acf4dc5

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Rakefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# frozen_string_literal: true
22

3+
require "etc"
34
require "pathname"
45
require "securerandom"
56
require "shellwords"
@@ -37,7 +38,11 @@ multitask(:test) do
3738
ruby(*%w[-w -e], rb, verbose: false) { fail unless _1 }
3839
end
3940

40-
xargs = %w[xargs --no-run-if-empty --null --max-procs=0 --max-args=300 --]
41+
# Cap parallelism at the CPU count. `--max-procs=0` spawns one process per
42+
# 300-file batch with no upper bound; on large SDKs (thousands of files) that
43+
# oversubscribes CPUs and stacks up rubocop processes, exhausting memory and
44+
# slowing CI to the point of timing out.
45+
xargs = %W[xargs --no-run-if-empty --null --max-procs=#{Etc.nprocessors} --max-args=300 --]
4146
ruby_opt = {"RUBYOPT" => [ENV["RUBYOPT"], "--encoding=UTF-8"].compact.join(" ")}
4247

4348
filtered = ->(ext, dirs) do

0 commit comments

Comments
 (0)