-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
AsyncLocalStorage supporting in callback & promise & plugin #10233
Conversation
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.
Thanks for the detailed PR, but I don't think this functionality belongs in Mongoose because async hooks are still an experimental API for Node.js and not supported in all the Node.js versions that Mongoose supports.
I think this change would be better suited for our @mongoosejs/async-hooks
plugin, which is meant to provide async hooks integration for Mongoose.
Your example doesn't seem like it works as expected with @mongoosejs/async-hooks
- would you be willing to move this code over to that repo?
[OK] [static-hooks] [pre] [save]
[OK] [static-hooks] [post] [save]
[OK] [static-hooks] [pre] [save]
[ERROR] [static-hooks] [post] [save] cac4238f-7f84-43b9-af51-76d8a4db9e49 24010a65-3c28-4047-b988-0f7f6f872498
[OK] [static-hooks] [pre] [save]
[ERROR] [static-hooks] [post] [save] 6368d57d-5943-4d7f-958b-06c3181179dd 24010a65-3c28-4047-b988-0f7f6f872498
[OK] [static-hooks] [pre] [save]
[ERROR] [static-hooks] [post] [save] 5f4984db-b900-4068-99ec-521d9f7bf7c4 24010a65-3c28-4047-b988-0f7f6f872498
[OK] [static-hooks] [pre] [save]
[ERROR] [static-hooks] [post] [save] 5328903c-4a86-4a7e-8be8-69fa855ba79c 24010a65-3c28-4047-b988-0f7f6f872498
[OK] [static-hooks] [pre] [save]
[ERROR] [static-hooks] [post] [save] 9e9bb6b8-0626-4376-a6d9-ad60fe17c109 24010a65-3c28-4047-b988-0f7f6f872498
[OK] [static-hooks] [pre] [save]
[ERROR] [static-hooks] [post] [save] 5c7dc699-9e46-42c1-8321-afd48d4f092d 24010a65-3c28-4047-b988-0f7f6f872498
[OK] [static-hooks] [pre] [save]
[ERROR] [static-hooks] [post] [save] a489d4fd-3ac8-40f5-8c6c-d69f8c42ed9a 24010a65-3c28-4047-b988-0f7f6f872498
[OK] [static-hooks] [pre] [save]
[ERROR] [static-hooks] [post] [save] ca05f783-871a-42b1-8602-93f4e4e6d6c6 24010a65-3c28-4047-b988-0f7f6f872498
…er & real mongo server
…er & real mongo server
…er & real mongo server
@vkarpov15 Thanks for your reply For eslint issue I have convert async/await style to promise style in test case, and I have test in windows, mac and linux with nodejs > v13.10.0, all platforms are working as expetced. Can you help to confirm which version of nodejs did you used? This PR contains AsyncLocalStorage feature detection. if not support(nodejs < 13.0.0), the feature was auto disabled. I will try to test @mongoose/async-hooks plugin later and try to move this code over to that repo |
closing this PR because it didnt see any updates in quite some time and Node discourages the use of |
Mongoose doesn't support async hooks, this PR enable this feature.
Features
Special Case:
[IMPORTANT] plugin for
aggregate
should be individual processingTest case:
NOTE: This PR also fix #10020