network icon indicating copy to clipboard operation
network copied to clipboard

refactor: Move process exit handlers from the trackerless-network to the node package

Open juslesan opened this issue 4 months ago • 2 comments

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 exit case 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.md and packages/sdk/README.md to call StreamrClient.destroy() when done.

Written by Cursor Bugbot for commit f2d88f0f5cb925fd43b48aa80f7440278bbbdd8e. This will update automatically on new commits. Configure here.

juslesan avatar Oct 24 '25 12:10 juslesan