Skip to content

Commit

Permalink
fix(gatsby-plugin-sharp): add output file cache back for non job api (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
wardpeet authored and GatsbyJS Bot committed Jan 27, 2020
1 parent 0e8ed07 commit 64a5399
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/gatsby-plugin-sharp/src/scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ const scheduleJob = async (job, boundActionCreators, reporter) => {
return cloudJob
}

// If output file already exists don't re-run image processing
// this has been in here from the beginning, job api v2 does this correct
// to not break existing behahaviour we put this in here too.
job.args.operations = job.args.operations.filter(
operation => !fs.existsSync(path.join(job.outputDir, operation.outputPath))
)

if (!job.args.operations.length) {
jobsInFlight.set(jobDigest, Promise.resolve())
return jobsInFlight.get(jobDigest)
}

const jobId = uuidv4()
boundActionCreators.createJob(
{
Expand Down

0 comments on commit 64a5399

Please sign in to comment.