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

fix(IRC): handle expected websocket error when leaving last room #16

Merged

Conversation

kevinrpb
Copy link
Contributor

Hiya! Bringing a quick one here for review.

I was noticing some unexpected states in my app and I was able to pin the issue down to some errors being thrown by IRCConnection that were not being handled upstream. The specific error I was seeing happened because it turns out that when the IRCConnection 'parts' from the last room it was connected to, the websocket gets disconnected. This causes the next call to websocket.receive() to throw an error.

I have added some logic to handle this and also made sure to bubble up any unhandled errors so they don't get 'eaten' in the Task calls and they can be properly handled by the client. Let me know what you think!

Cheers.

When the IRCConnection 'parts' from the last room they were in, the
websocket gets disconnected and throws the next time we try to call
receive().
Copy link
Owner

@LosFarmosCTL LosFarmosCTL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, this looks good to me!

In general, maybe the last remaining connection in a pool shouldn't be disconnected even when the last channel is PARTed, I haven't thought about that when writing the initial implementation, but this change would still be needed regardless for any additional connections that are created.

@LosFarmosCTL LosFarmosCTL merged commit 4ae19df into LosFarmosCTL:main Sep 23, 2024
4 checks passed
@kevinrpb
Copy link
Contributor Author

Nice catch, this looks good to me!

Cool! Thanks for merging 😄

In general, maybe the last remaining connection in a pool shouldn't be disconnected

Well, I'm not sure we can actually control that. From what I've seen is Twitch that is closing the socket 😓 .

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.

2 participants