-
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
feat(gatsby): PQR: merge data dependencies from workers to the main process #32305
Conversation
Just so there is papertrail on PR: keep in mind gatsby/packages/gatsby/src/redux/reducers/html.ts Lines 91 to 120 in 54ed0c3
|
d1af064
to
cb80dab
Compare
Yeah, after some thinking I've changed the implementation to just replaying actions after each chunk is done. If data dependencies will be too expensive to sync this way - we can do a hybrid approach - forward/replay some actions and merge expensive parts all at once in the end. But first, let's try the simple approach with just replaying actions. |
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.
Two smaller nits
Co-authored-by: Lennart <[email protected]>
…rocess (#32305) * feat(gatsby): PQR: merge data dependencies from workers to the main process * Move worker state merging to a standalone step * revert acciental change * different approach: replay actions vs merging state * revert unneded changes * do not use inline snapshot * Update packages/gatsby/src/utils/worker/__tests__/queries.ts Co-authored-by: Lennart <[email protected]> Co-authored-by: Lennart <[email protected]> (cherry picked from commit bdb9352)
…rocess (#32305) (#32438) * feat(gatsby): PQR: merge data dependencies from workers to the main process * Move worker state merging to a standalone step * revert acciental change * different approach: replay actions vs merging state * revert unneded changes * do not use inline snapshot * Update packages/gatsby/src/utils/worker/__tests__/queries.ts Co-authored-by: Lennart <[email protected]> Co-authored-by: Lennart <[email protected]> (cherry picked from commit bdb9352) Co-authored-by: Vladimir Razuvaev <[email protected]>
Description
We need to sync parts of the build state from the query worker to the main process. This PR "replays" selected actions from workers in the main process when each query chunk is finished.
The alternative approach would be to merge state at the end of query running but this may be error-prone and harder to maintain because requires that each reducer interested in query events additionally "knows" about this potential merge step.
The upside of state merging is that it can be more performant and has less IPC communication overhead. So we may get back to it eventually if action replaying proves to be too expensive.
[ch33833]