-
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
chore(gatsby): cleanup api runner promises #19664
Conversation
c72cb4d
to
c2c1e0a
Compare
You could use async iterators with |
It's an excellent point :) |
Had to test a few cases and conclusion is that this is not a safe refactor. https://jsfiddle.net/3vuk4yfj/ In short, the refactor would not allow you to resolve the promise regarless of recursive ("cascading") calls. And it would not wait for all apis of the same name to finish before resolving the outer promise, which is also breaking the current model. So I'll go back to before that. |
8cede86
to
16f89c5
Compare
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.
At first glace this looks 👌. I've added 2 comments, nothing major. I'll be testing this on a few sites.
The diff is misleading; the runPlugin func wasn't moved, instead the afterPlugin was inlined back as that just makes more sense now.
Not sure whether removing this check makes things better or worse so I'd better not touch it for now.
16f89c5
to
5b044eb
Compare
(rebased) |
This attempts to remove a bunch of BlueBird promises from the api runner, in favor of native Promises.
It also cleans up the core of the api-runner by eliminating a bunch of controls that would never really be used due to how promises get resolved and non-blocking works.