(fix) improve handling of unhealthy websockets connections (backport #2854) #2873
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.
Changelist
Publishing errors were caught on each attempt to send a message from a batch to a subscriber. Now, first error in publishing to a subscriber will break the publishing loop, minimizing redundant error generation.
Websockets that failed to respond to pings were terminated and cleaned up without an attempt to close the connection with an informative error.
remove unnecessary typed buffer conversions
minimize connection lookups by passing Connection and not id
add connectionId to
Connection
extract metrics to methods for clarity
simplify error handling in wss send
add constants for websocket error codes
remove ad-hoc listener removal in InvalidMessageHandler
Test Plan
Unit Tests
Run in internal environments and public testnet
Summary by CodeRabbit
This is an automatic backport of pull request #2854 done by [Mergify](https://mergify.com).