-
Notifications
You must be signed in to change notification settings - Fork 154
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
chore (client): expose a close method on the ElectricNamespace to dispose its resources #703
Conversation
VAX-971 client: Leaky resources (Notifier subscriptions, EventEmitter listeners...)
Here I list some places in the client code which leak subscriptions to the notifier, as they are never cleared up. These are the ones we found while working on the Dart client.
|
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 addressing this. A couple of suggestions:
- Maybe we should have a lifecycle test for electric testing that a process is registered after the electrification and deregistered after close. I'm not sure how much code is available to test this, but if not low-hanging I'm happy to skip
- Please double check that the things that are allocated for a process are all de-allocated and that we're not leaking any resources, or not de-registering from global stuff. This might have been the last thing, but let's do another pass before closing [VAX-971] client: Leaky resources (Notifier subscriptions, EventEmitter listeners...) #243.
1b806f5
to
e11d59a
Compare
…r to delete the listener from the right object.
… resource cleanup
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 looking into suggestions
This PR addresses the first task of #243.
As suggested, the
ElectricNamespace
(and thus also theElectricClient
as it extends the namespace) now exposes aclose
method that can be called by the user to dispose all resources used by the Electric client. Thisclose
method calls thestop
on the global registry such that it also stops the client's satellite process.