Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gatsby-plugin-sharp): add output file cache back for non job api #20905

Merged
merged 1 commit into from
Jan 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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