-
Notifications
You must be signed in to change notification settings - Fork 537
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Description
When using RealtimeClient with the worker: true option, Web Workers are never terminated when the connection is disconnected. This causes memory accumulation as workers continue running indefinitely even after the client has been torn down.
Current behavior:
- Workers are created in
_startWorkerHeartbeat()(line 691) - Workers are never terminated in
_teardownConnection()(line 628-649) - Each disconnect/reconnect cycle leaks one worker
- Workers continue sending heartbeat messages even when disconnected
Expected behavior:
- Workers should be terminated when
disconnect()is called - Worker references should be cleared for garbage collection
- No orphaned workers should remain after disconnection
I intend to submit a PR for this issue.
Suggested solution
Add a _terminateWorker() private method that properly terminates the Web Worker and clears the reference, then call it during connection teardown and then update _teardownConnection() to call it.
Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request