-
Notifications
You must be signed in to change notification settings - Fork 565
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
fix: forward dispatch return value #3368
Conversation
1512421
to
1d160da
Compare
Things this doesn't solve.
|
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.
It has sense; I just feel that this can cause the false sensation of having a fully fledge dispatcher
.
It might be possible that we end with max listeners problems.
Shall we tests the events are emitted as we expect?
I feel this is just a hack until we have a better solution. |
We would need to have some form of weak event listeners for this to work well. |
@benjamingr Do you have any input on how we can have weak event listeners here that when the |
f1e14a3
to
8855481
Compare
This is still not great though... until GC the event listeners are still registered. |
The alternative is that we have some kind of ref/unref API. But that is going to be a constant pain of people doing it wrong. |
We don't currently expose it but you can use kWeakHandler in the version bundled with Node, that lets you pass a listener and an object that the listener's lifetime is bound to - that's EventTarget though. So we would need to build kWeakHandler (or similar) to EventEmitter and expose that to undici somehow - it has to be baked into the abstraction (EventEmitter) itself - otherwise it leaks the WeakRef itself (as you probably noticed). |
@metcoder95 @mcollina wdyt of returning a |
This sounds great, but personally I'm afraid we will be attaching
It simplifies a lot certainly, how does the gc behave (out of curiosity mostly)? |
We cannot say anything definite about gc behavior. It's totally undefined. |
Refs: #3373
Refs: #3370