-
Notifications
You must be signed in to change notification settings - Fork 69
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
Emit destroy hook when AsyncResource has fulfilled its purpose #86
Conversation
Thank you, very interesting! Is it possible to do this without modifying where you did? You modified our inline function that is supposed to just backport Also, please add a test to our test suite for this, that will fail without this change and paas with the change ❤️ |
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.
See comment
Thanks for the review @dougwilson! I've looked more into it and the So looks like it is more of an integration issue than a bug in The workaround is to manually call GC (and it solves the issue), but that requires passing |
That seems odd, then how would anyone use the |
Well, as I said, it's not really a bug in either of the places, it's the interaction which is the problem.
I don't think Node can "fix" I don't think Jest can change their logic to wait for/trigger GC, because GC is not available by default and forcing all consumers to pass
Based on the above, I don't think escalation will bring us much. |
To me it really boils down to whether you're as a library author are willing to bring in extra complexity to make the library play nice with Jest out of the box or leave that burden to the Jest user to figure it out (by e.g. calling GC manually). IMO it would be nice to make the integration work out of the box, but I can totally understand if you don't want to have this extra complexity and then we can close this PR and I can workaround it on the consumer side. |
The project intends to handle wrapping event emitters for async hooks following the Node.js documentation. https://nodejs.org/api/async_context.html#integrating-asyncresource-with-eventemitter |
Fixes #85