Skip to content

Commit 465404a

Browse files
committed
update counts with max 1
1 parent fb9e35e commit 465404a

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

packages/gatsby-plugin-manifest/src/gatsby-node.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
import * as fs from "fs"
22
import * as path from "path"
33
import sharp from "./safe-sharp"
4-
import { createContentDigest, cpuCoreCount, slash } from "gatsby-core-utils"
4+
import { createContentDigest, slash } from "gatsby-core-utils"
55
import { defaultIcons, addDigestToPath, favicons } from "./common"
66
import { doesIconExist } from "./node-helpers"
77

88
import pluginOptionsSchema from "./pluginOptionsSchema"
99

1010
sharp.simd(true)
1111

12-
// Handle Sharp's concurrency based on the Gatsby CPU count
13-
// See: http://sharp.pixelplumbing.com/en/stable/api-utility/#concurrency
14-
// See: https://www.gatsbyjs.org/docs/multi-core-builds/
15-
sharp.concurrency(cpuCoreCount() - 1)
12+
// force it to be 1 as we only resize one image
13+
sharp.concurrency(1)
1614

1715
async function generateIcon(icon, srcIcon) {
1816
const imgPath = path.join(`public`, icon.src)

packages/gatsby-plugin-sharp/src/gatsby-worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const q = queue(
3232
args.pluginOptions
3333
)
3434
),
35-
cpuCoreCount() - 1
35+
Math.max(1, cpuCoreCount() - 1)
3636
)
3737

3838
/**

packages/gatsby/src/utils/webpack-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ export const createWebpackUtils = (
660660
},
661661
...terserOptions,
662662
},
663-
parallel: cpuCoreCount() - 1,
663+
parallel: Math.max(1, cpuCoreCount() - 1),
664664
...options,
665665
})
666666

@@ -731,7 +731,7 @@ export const createWebpackUtils = (
731731
}
732732
): CssMinimizerPlugin =>
733733
new CssMinimizerPlugin({
734-
parallel: cpuCoreCount() - 1,
734+
parallel: Math.max(1, cpuCoreCount() - 1),
735735
...options,
736736
})
737737

packages/gatsby/src/utils/worker/pool.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { cpuCoreCount } from "gatsby-core-utils"
33

44
export const create = (): Worker =>
55
new Worker(require.resolve(`./child`), {
6-
numWorkers: cpuCoreCount() - 1,
6+
numWorkers: Math.max(1, cpuCoreCount() - 1),
77
forkOptions: {
88
silent: false,
99
},

0 commit comments

Comments
 (0)