-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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(node): Auto-select best AsyncContextStrategy
for Node.js version
#7804
feat(node): Auto-select best AsyncContextStrategy
for Node.js version
#7804
Conversation
* Node.js >= 14 uses AsyncLocalStorage | ||
* Node.js < 14 uses domains | ||
*/ | ||
export function setNodeAsyncContextStrategy(): void { |
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.
Can we get a sanity check test for this?
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.
How do you mean? A test that checks that the version detection is working?
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.
yup, but now that I think about it, it's maybe too complicated. We can add one any time later on.
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, I'm surprised that there was no TypeScript or lint error from using if (NODE_VERSION >= 14)
!
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.
🚀
Automatically select the best
AsyncContextStrategy
for the Node.js version.AsyncLocalStorage