Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion ng-dev/format/run-commands-parallel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ import {info} from '../utils/console';

import {Formatter, FormatterAction, getActiveFormatters} from './formatters/index';

const AVAILABLE_THREADS = Math.max(cpus().length - 1, 1);
// Some environments, like CircleCI which use Docker report a number of CPUs by the host and not the count of available.
// This causes the task to be killed when formatting a large number of files due lack of resources.
// https://github.com/nodejs/node/issues/28762
const AVAILABLE_THREADS = Math.max(Math.min(cpus().length, 8) - 1, 1);

/** Interface describing a failure occurred during formatting of a file. */
export interface FormatFailure {
Expand Down
2 changes: 1 addition & 1 deletion tools/local-actions/changelog/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -48561,7 +48561,7 @@ var require_run_commands_parallel = __commonJS({
var child_process_1 = require_child_process();
var console_1 = require_console();
var index_1 = require_formatters();
var AVAILABLE_THREADS = Math.max((0, os_1.cpus)().length - 1, 1);
var AVAILABLE_THREADS = Math.max(Math.min((0, os_1.cpus)().length, 8) - 1, 1);
function runFormatterInParallel(allFiles, action) {
return new Promise((resolve) => {
const formatters = (0, index_1.getActiveFormatters)();
Expand Down