Emit destroy hook when AsyncResource has fulfilled its purpose#86
Emit destroy hook when AsyncResource has fulfilled its purpose#86devoto13 wants to merge 1 commit intostream-utils:masterfrom
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 ❤️ |
|
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