Skip to content

Commit afb6812

Browse files
committed
PR feedback
1 parent ab905d9 commit afb6812

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

libraries/rush-lib/src/logic/operations/WeightedOperationPlugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ function weightOperations(
4848
*/
4949
function _tryConvertPercentWeight(weight: `${number}%`): number {
5050
if (!percentageRegExp.test(weight)) {
51-
throw new Error(`Expected a percentage string like "100%".`);
51+
throw new Error(`Because the JSON value is a string, expecting a percentage like "23.4%".`);
5252
}
5353

5454
const percentValue: number = parseFloat(weight.slice(0, -1));
5555

5656
// Use as much CPU as possible, so we round down the weight here
57-
return Math.floor((percentValue / 100) * availableParallelism);
57+
return Math.max(1, Math.floor((percentValue / 100) * availableParallelism));
5858
}
5959

6060
for (const [operation, record] of operations) {

libraries/rush-lib/src/schemas/rush-project.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
{
111111
"type": "string",
112112
"pattern": "^[1-9][0-9]*(\\.\\d+)?%$",
113-
"description": "The number of concurrency units that this operation should take up, as a percent of `os.availableParallelism()`. At runtime this value will be clamped to the range `[1, rushParallelism]`, where `rushParallelism` is the requested parallelism to the current Rush command. To have this operation consume no concurrency, use the literal value `0`."
113+
"description": "The number of concurrency units that this operation should take up, as a percent of `os.availableParallelism()`. At runtime this value will be clamped to the range `[1, rushParallelism]`, where `rushParallelism` is the requested parallelism to the current Rush command. To have this operation consume no concurrency, use the number 0 instead of a string."
114114
},
115115
{
116116
"description": "The number of concurrency units that this operation should take up. At runtime this value will be clamped to the range `[0, rushParallelism]`, where `rushParallelism` is the requested parallelism to the current Rush command.",

0 commit comments

Comments
 (0)