diff --git a/packages/gatsby-plugin-sharp/src/gatsby-worker.js b/packages/gatsby-plugin-sharp/src/gatsby-worker.js index aca5238618285..e8c1b212e45cf 100644 --- a/packages/gatsby-plugin-sharp/src/gatsby-worker.js +++ b/packages/gatsby-plugin-sharp/src/gatsby-worker.js @@ -1,5 +1,6 @@ const path = require(`path`) const queue = require(`async/queue`) +const { cpuCoreCount } = require(`gatsby-core-utils`) const { processFile } = require(`./process-file`) exports.IMAGE_PROCESSING_JOB_NAME = `IMAGE_PROCESSING` @@ -31,7 +32,7 @@ const q = queue( args.pluginOptions ) ), - 1 + cpuCoreCount() ) /** diff --git a/packages/gatsby-plugin-sharp/src/process-file.js b/packages/gatsby-plugin-sharp/src/process-file.js index 00e31434e54f1..00d57100e748a 100644 --- a/packages/gatsby-plugin-sharp/src/process-file.js +++ b/packages/gatsby-plugin-sharp/src/process-file.js @@ -8,7 +8,7 @@ const imageminMozjpeg = require(`imagemin-mozjpeg`) const imageminPngquant = require(`imagemin-pngquant`) const { healOptions } = require(`./plugin-options`) const { SharpError } = require(`./sharp-error`) -const { cpuCoreCount, createContentDigest } = require(`gatsby-core-utils`) +const { createContentDigest } = require(`gatsby-core-utils`) // Try to enable the use of SIMD instructions. Seems to provide a smallish // speedup on resizing heavy loads (~10%). Sharp disables this feature by @@ -16,10 +16,8 @@ const { cpuCoreCount, createContentDigest } = require(`gatsby-core-utils`) // adventurous and see what happens with it on. sharp.simd(true) -// Handle Sharp's concurrency based on the Gatsby CPU count -// See: http://sharp.pixelplumbing.com/en/stable/api-utility/#concurrency -// See: https://www.gatsbyjs.org/docs/multi-core-builds/ -sharp.concurrency(cpuCoreCount()) +// Concurrency is handled in gatsby-worker queue instead +sharp.concurrency(1) /** * @typedef DuotoneArgs