-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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: async context #24402
feat: async context #24402
Conversation
66783c5
to
5889a93
Compare
67d1585
to
8ba06ce
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.
Nice work! Just left one question
const unboundCallback = callback; | ||
const asyncContext = getAsyncContext(); | ||
callback = () => { | ||
const oldContext = getAsyncContext(asyncContext); | ||
try { | ||
setAsyncContext(asyncContext); | ||
ReflectApply(unboundCallback, globalThis, args); | ||
} finally { | ||
setAsyncContext(oldContext); | ||
} | ||
}; |
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.
Great that it will now work with timers!
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.
LGTM
Reverts #24402 deno_web can't depend on code in runtime
We are switching to ContinuationPreservedEmbedderData. This allows adding async context tracking to the various async operations that deno provides.
Fixes: #7010
Fixes: #22886
Fixes: #24368