Repository navigation
feat: add dispose method to the client - #206
Merged
Merged
Conversation
Signed-off-by: İspik <ispik@ispik.dev>
8 tasks done
Signed-off-by: İspik <ispik@ispik.dev>
Signed-off-by: İspik <ispik@ispik.dev>
Signed-off-by: İspik <ispik@ispik.dev>
Contributor
|
Nice, this should definitely simplify the teardown process in for-web |
Signed-off-by: Jacob Schlecht <dadadah@echoha.us>
Signed-off-by: Jacob Schlecht <dadadah@echoha.us>
Signed-off-by: Jacob Schlecht <dadadah@echoha.us>
Signed-off-by: Jacob Schlecht <dadadah@echoha.us>
Signed-off-by: Jacob Schlecht <dadadah@echoha.us>
Signed-off-by: Jacob Schlecht <dadadah@echoha.us>
Signed-off-by: Jacob Schlecht <dadadah@echoha.us>
Signed-off-by: Jacob Schlecht <dadadah@echoha.us>
Signed-off-by: Jacob Schlecht <dadadah@echoha.us>
10 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
Client.dispose()Adds a way to fully tear down a
Clientso it can be garbage collected. Needed by for-web to fix a memory leak on logout and account switching (stoatchat/for-web#1803).Changes:
Client.dispose(): cancels pending reconnects, removes all listeners, closes the events socket, clears channel timers, resets ready, entitlements and viewAs, then empties all collections. Safe to call more than once.Client.disposedgetter;connect()does nothing after disposallogout()now always disposes, even if the logout request failsChannel._clearTimers()(internal): clears typing, ack and slowmode timersStoreCollection._clear()(internal): drops every object in a collectionCollections are cleared on the next tick, so UI that's still being torn down doesn't see empty data. If something outside the library still references a disposed client, it only holds an empty object, not the whole account's data.