-
Notifications
You must be signed in to change notification settings - Fork 43
refactor: Move process exit handlers from the trackerless-network to the node package #3224
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
base: main
Are you sure you want to change the base?
Conversation
teogeb
left a comment
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.
Could be worth the effort to update the sdk's README to make sure that users are aware that they need to call StreamrClient#destroy always when shutting down the process.
Yes, let's add that
For browser nodes the graceful leaving on unload event is still kept in the trackerless-network. Alternatively the on unload event handler could be removed as well. If this is done the users must be made aware that they need to call NetworkNode#stop manually when a browser window is closed.
The StreamrClient#destroy() does that, right? So when we have the documentation, we can remove this functionality, too.
|
So if I understood correctly do you @teogeb want to remove the clean up from the on unload events as well? |
Yes |
| ``` | ||
|
|
||
| ### Clean up | ||
| After the StreamrClient is no longer used or the process is shutting down it is very important to call `destroy` on the StreamrClient. This ensures that the network node of the client will be shutdown gracefully. |
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.
| After the StreamrClient is no longer used or the process is shutting down it is very important to call `destroy` on the StreamrClient. This ensures that the network node of the client will be shutdown gracefully. | |
| After the `StreamrClient` is no longer used or the process is shutting down it is very important to call `destroy()` on the `StreamrClient`. This ensures that the network node of the client will be shutdown gracefully. |
| ``` | ||
|
|
||
| ### Clean up | ||
| After the StreamrClient is no longer used or the process is shutting down it is very important to call `destroy` on the StreamrClient. This ensures that the network node of the client will be shutdown gracefully. |
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.
Worth mentioning also here? https://docs.streamr.network/usage/sdk/how-to-use
| process.exit(exitCode) | ||
| } | ||
|
|
||
| const exitEvents = ['SIGINT', 'SIGTERM', 'SIGUSR1', 'SIGUSR2'] |
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.
Could clarify in the PR description why exit event type is no longer handled?
Summary
Moved exit handlers from the
trackerless-networkto thenodepackage. This ensures that the operator nodes will still gracefully leave the network if the process is exited. Also removed the on unload event listener in NetworkStack. Users of the SDK are being made aware of the change by updating the SDK's README to include a section about properly cleaning up the Network node when the StreamrClient is no longer needed.