Skip to content

Commit 64a5399

Browse files
wardpeetGatsbyJS Bot
authored and
GatsbyJS Bot
committed
fix(gatsby-plugin-sharp): add output file cache back for non job api (#20905)
1 parent 0e8ed07 commit 64a5399

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

+12
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,18 @@ const scheduleJob = async (job, boundActionCreators, reporter) => {
6161
return cloudJob
6262
}
6363

64+
// If output file already exists don't re-run image processing
65+
// this has been in here from the beginning, job api v2 does this correct
66+
// to not break existing behahaviour we put this in here too.
67+
job.args.operations = job.args.operations.filter(
68+
operation => !fs.existsSync(path.join(job.outputDir, operation.outputPath))
69+
)
70+
71+
if (!job.args.operations.length) {
72+
jobsInFlight.set(jobDigest, Promise.resolve())
73+
return jobsInFlight.get(jobDigest)
74+
}
75+
6476
const jobId = uuidv4()
6577
boundActionCreators.createJob(
6678
{

0 commit comments

Comments
 (0)