Skip to content
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

Merged
merged 2 commits into from
Apr 11, 2023

Conversation

timfish
Copy link
Collaborator

@timfish timfish commented Apr 11, 2023

Automatically select the best AsyncContextStrategy for the Node.js version.

  • Node.js >= 14 uses AsyncLocalStorage
  • Node.js < 14 uses domains

@timfish timfish mentioned this pull request Apr 11, 2023
9 tasks
* Node.js >= 14 uses AsyncLocalStorage
* Node.js < 14 uses domains
*/
export function setNodeAsyncContextStrategy(): void {
Copy link
Member

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?

Copy link
Collaborator Author

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?

Copy link
Member

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.

Copy link
Collaborator Author

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)!

Co-authored-by: Abhijeet Prasad <devabhiprasad@gmail.com>
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@AbhiPrasad AbhiPrasad merged commit 4856685 into getsentry:develop Apr 11, 2023
@timfish timfish deleted the feat/auto-select-async-strategy branch April 11, 2023 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants