Skip to content

Commit

Permalink
fix(gatsby-plugin-sharp): create job before async-queue processing (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
wardpeet committed Jun 12, 2019
1 parent 0a5a1f2 commit f566210
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/gatsby-plugin-sharp/src/scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ exports.scheduleJob = async (
})

if (!isQueued) {
// Create image job
boundActionCreators.createJob(
{
id: `processing image ${job.inputPath}`,
imagesCount: 1,
},
{ name: `gatsby-plugin-sharp` }
)

q.push(cb => {
runJobs(
inputFileKey,
Expand Down Expand Up @@ -86,10 +95,12 @@ function runJobs(

// Delete the input key from the toProcess list so more jobs can be queued.
delete toProcess[inputFileKey]
boundActionCreators.createJob(

// Update job info
boundActionCreators.setJob(
{
id: `processing image ${job.inputPath}`,
imagesCount: _.values(toProcess[inputFileKey]).length,
imagesCount: jobs.length,
},
{ name: `gatsby-plugin-sharp` }
)
Expand Down

0 comments on commit f566210

Please sign in to comment.