Skip to content

Commit f566210

Browse files
authored
fix(gatsby-plugin-sharp): create job before async-queue processing (#14731)
1 parent 0a5a1f2 commit f566210

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

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

+13-2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ exports.scheduleJob = async (
5959
})
6060

6161
if (!isQueued) {
62+
// Create image job
63+
boundActionCreators.createJob(
64+
{
65+
id: `processing image ${job.inputPath}`,
66+
imagesCount: 1,
67+
},
68+
{ name: `gatsby-plugin-sharp` }
69+
)
70+
6271
q.push(cb => {
6372
runJobs(
6473
inputFileKey,
@@ -86,10 +95,12 @@ function runJobs(
8695

8796
// Delete the input key from the toProcess list so more jobs can be queued.
8897
delete toProcess[inputFileKey]
89-
boundActionCreators.createJob(
98+
99+
// Update job info
100+
boundActionCreators.setJob(
90101
{
91102
id: `processing image ${job.inputPath}`,
92-
imagesCount: _.values(toProcess[inputFileKey]).length,
103+
imagesCount: jobs.length,
93104
},
94105
{ name: `gatsby-plugin-sharp` }
95106
)

0 commit comments

Comments
 (0)