-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
refactor(gatsby): Make query queue constructable #13061
refactor(gatsby): Make query queue constructable #13061
Conversation
f83d752
to
1b5f5f5
Compare
Conflicts resolved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just 2 questions
|
||
const queryJobs = makeQueryJobs(pathnamesToRun) | ||
|
||
const queue = queryQueue.makeBuild() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calling it makeBuild
is a bit weird here, I get why it's called that way by checking the full PR but it doesn't really fit in my mind 😋 I can't come up with a better name either as I was thinking of makeStatic
or makePassive
but that's even weirder 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it makes sense within query-queue.js
(since there's makeBuild
and makeDevelop
, but you're right that it's a bit confusing from outside.
The other possibility I considered was to move makeBuild
into page-query-runner
, and call it makeQueryQueue
. That way we could pull makeDevelop
directly into src/commands/develop.js
(and just call it makeQueryQueue
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like what you're thinking. Moving makeDevelop
in src/commands/develop.js
probably makes the file more bloated which can also make it harder to understand.
I'll just merge after testing and let's have a look afterwards.
@@ -221,3 +161,72 @@ const findDirtyIds = actions => { | |||
) | |||
return uniqDirties | |||
} | |||
|
|||
const runInitialQueries = async activity => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is sooo much cleaner than what we had before! 👍
@@ -124,7 +124,6 @@ const preferDefault = m => m && m.default || m | |||
writeAndMove(`pages.json`, JSON.stringify(pagesData, null, 4)), | |||
writeAndMove(`sync-requires.js`, syncRequires), | |||
writeAndMove(`async-requires.js`, asyncRequires), | |||
writeAndMove(`match-paths.json`, JSON.stringify(matchPaths, null, 4)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I removed it because the match-paths
PR wasn't merged when I opened this PR. But that's resolved now. I'll add it back in. Great find!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 76d56ba
Published in |
Description
#13004 requires that page queries be executed after the javascript build completes. To get there, we need to be able to process a batch of queries. The current code relies on a global query queue, and uses complex global events to ensure it's paused/resumed during bootstrap. This PR makes the queue constructable so that a batch of queries can be processed easily.
I also noticed that
develop
queue is much more complex that thebuild
queue, so I've separated those into two queue constructors.Related Issues