Skip to content

Commit

Permalink
fix(builders): default to a minimum of 1 CPU when sharding builds
Browse files Browse the repository at this point in the history
Closes #1466
  • Loading branch information
alan-agius4 committed Jan 24, 2020
1 parent d2e1b12 commit cf5509f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/builders/src/prerender/utils.ts
Expand Up @@ -56,7 +56,7 @@ export async function getRoutes(
* Evenly shards items in an array.
* e.g. shardArray([1, 2, 3, 4], 2) => [[1, 2], [3, 4]]
*/
export function shardArray<T>(items: T[], maxNoOfShards = os.cpus().length - 1): T[][] {
export function shardArray<T>(items: T[], maxNoOfShards = (os.cpus().length - 1) || 1): T[][] {
const shardedArray = [];
const numShards = Math.min(maxNoOfShards, items.length);
for (let i = 0; i < numShards; i++) {
Expand Down

0 comments on commit cf5509f

Please sign in to comment.