-
Notifications
You must be signed in to change notification settings - Fork 1.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
fix: propagate async context #2298
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Upon deeper inspection, I think this PR should still be preferred, as it avoids creating async resources and using MakeCallback (with its tick affecting behaviour) for synchronous calls. I can rebase if folks agree. |
Looks good as far as I can see. |
This is an alternative to some of the fixes in [1]. Starting with Nan 2.9.0, we have the ability to propagate async context across async hops. Certain variants of Nan::Callback::Call are now deprecated to encourage use of the context presevering alternatives. Certain variants of Node's MakeCallback that were used internally are going to be deprecated in Node 10. Summary is that one should use Nan::Call for sync calls, and Nan::Callback::Call for async. The latter expects an async resource corresponding to the async operation to be provided at the call time. This patch fixes things up so that 1) node-sass isn't using any deprecated APIs, and 2) properly propagates async context for async callbacks by creating async resources in the appropriate places. [1]: sass#2295
ofrobots
force-pushed
the
propagate-context
branch
from
March 19, 2018 18:24
af79443
to
e46be3b
Compare
Rebased. |
Thanks for this @ofrobots. Looks the CI failure was transient. |
jiongle1
pushed a commit
to scantist-ossops-m2/node-sass
that referenced
this pull request
Apr 7, 2024
This change breaks browser compat for IE < 10 so it is scheduled for 3.6. It will not be back ported to the 3.5 line. See sass/sass#1782 Fixes sass#2298 Spec sass/sass-spec#1242
jiongle1
pushed a commit
to scantist-ossops-m2/node-sass
that referenced
this pull request
Apr 7, 2024
This change breaks browser compat for IE < 10 so it is scheduled for 3.6. It will not be back ported to the 3.5 line. See sass/sass#1782 Fixes sass#2298 Spec sass/sass-spec#1242
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
EDIT: This is an improvement on some of the fixes in #2295.
Starting with Nan 2.9.0, we have the ability to propagate async context
across async hops. Certain variants of Nan::Callback::Call are now
deprecated to encourage use of the context presevering alternatives.
Certain variants of Node's MakeCallback that were used internally are
going to be deprecated in Node 10.
Summary is that one should use Nan::Call for sync calls, and
Nan::Callback::Call for async. The latter expects an async resource
corresponding to the async operation to be provided at the call time.
This patch fixes things up so that 1) node-sass isn't using any
deprecated APIs, and 2) properly propagates async context for async
callbacks by creating async resources in the appropriate places.
Related: nodejs/nan#755
/cc @xzyfer