network
network copied to clipboard
refactor: Move process exit handlers from the trackerless-network to the node package
Summary
Moved exit handlers from the trackerless-network to the node package. 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.
Other Changes
- The
exitcase is no longer handled as we cannot do asynchronous operations there.
[!NOTE] Move shutdown handling to the node CLI, remove global exit/unload handlers from trackerless-network, and document proper StreamrClient cleanup.
- Node CLI (
packages/node/bin/streamr-node.ts)
- Add graceful shutdown handlers for
SIGINT,SIGTERM,SIGUSR1,SIGUSR2.- On
uncaughtException/unhandledRejection, log fatal and stop broker before exit.- Trackerless Network (
packages/trackerless-network/src/NetworkStack.ts)
- Remove global process/window exit handlers and instance tracking; simplify
stop().- Docs
- Add cleanup guidance to
docs/docs/usage/sdk/how-to-use.mdandpackages/sdk/README.mdto callStreamrClient.destroy()when done.Written by Cursor Bugbot for commit f2d88f0f5cb925fd43b48aa80f7440278bbbdd8e. This will update automatically on new commits. Configure here.