Skip to content
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

Always clean up connection listeners #670

Merged
merged 1 commit into from
Aug 12, 2023

Conversation

canadaduane
Copy link
Contributor

The Connection class always adds websocket listeners but only conditionally removes them on close. This results in event listener leakage. Instead, we should always remove these listeners when the Connection is closed.

packages/server/src/Connection.ts Outdated Show resolved Hide resolved
packages/server/src/Connection.ts Show resolved Hide resolved
The Connection class always adds websocket listeners but only conditionally
removes them on close. This results in event listener leakage. Instead, we
should always remove these listeners when the Connection is closed.
@linspw
Copy link
Contributor

linspw commented Aug 10, 2023

I'm getting a similar message, is it because of this?

image

@canadaduane
Copy link
Contributor Author

I'm getting a similar message, is it because of this?

Yes! That's the same warning message we were seeing.

@janthurau
Copy link
Collaborator

hmm, not sure if this will fix the warning (as we will still add one listener per document), and I don't see how we can delete connections without matching this condition. I think the warning will only be fixed by #671 , but still happy to merge this :-) THX!

@janthurau janthurau merged commit 69affbf into ueberdosis:main Aug 12, 2023
3 checks passed
janthurau pushed a commit to YousefED/hocuspocus that referenced this pull request Aug 12, 2023
The Connection class always adds websocket listeners but only conditionally
removes them on close. This results in event listener leakage. Instead, we
should always remove these listeners when the Connection is closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants