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

Do not throw when pushing to errored or closed channel #3

Merged

Conversation

roughike
Copy link

@roughike roughike commented Jul 16, 2024

Throwing in this scenario prevents the channel from recovering as throwing interrupts code execution and adding events to the pushBuffer to be retried on successful reconnect.

The reference JS implementation does not throw either and this PR brings the behavior closer to the reference implementation: https://github.com/phoenixframework/phoenix/blob/25e891f172045aa0391d30bfd794111235041159/assets/js/phoenix/channel.js#L183-L184

_logger.finest(
() => 'Buffering push ${pushEvent.ref} for later send ($_state)');
pushEvent.startTimeout();
Copy link
Author

Choose a reason for hiding this comment

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

wish there was an easy way to test this

@roughike roughike requested a review from brian-superlist July 16, 2024 11:58
@roughike roughike merged commit 658661b into master Jul 16, 2024
1 check failed
@roughike roughike deleted the do-not-throw-when-pushing-to-errored-or-closed-channel branch July 16, 2024 14:01
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