Skip to content

Commit def1bb2

Browse files
chore(internal): bound formatter parallelism to CPU count
1 parent c11ea9a commit def1bb2

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"
@@ -59,7 +60,11 @@ namespace :test do
5960
end
6061
end
6162

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

6570
filtered = ->(ext, dirs) do

0 commit comments

Comments
 (0)