Open
Conversation
This commit moves the core stream management logic from the `gorums` package into a new `internal/stream` package to improve encapsulation and testability. Key changes: - Moved channel.go to `internal/stream` containing `Channel`, `Request`, and `Message` types along with their associated logic. - `Channel` now encapsulates the `grpc.ClientStream` lifecycle, handling connection establishment, reconnection, and message routing. - The `Node` struct delegates underlying communication and metrics (Latency, LastErr) to `Channel`. - Refactored `sender` and `receiver` loops in `Channel` for better robustness and to properly drain the send queue on closure, fixing potential deadlocks. - Updated `channel_test.go` with robust, table-driven tests covering connection states, context cancellation, and concurrent sends. - Added benchmarks for channel performance and stream reconnection.
Contributor
DeepSource reviewed changes in the commit range For detailed review results, please see the PR on DeepSource ↗ PR Report CardCode Review Summary
How are these analyzer statuses calculated?Administrators can configure which issue categories are reported and cause analysis to be marked as failed when detected. This helps prevent bad and insecure code from being introduced in the codebase. If you're an administrator, you can modify this in the repository's settings. |
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.
Fixes #268
This change moves the core stream management logic from the
gorumspackage into a newinternal/streampackage to improve encapsulation and testability.Key changes:
internal/streamcontainingChannel,Request, andMessagetypes along with their associated logic.Channelnow encapsulates thegrpc.ClientStreamlifecycle, handling connection establishment, reconnection, and message routing.Nodestruct delegates underlying communication and metrics (Latency, LastErr) toChannel.senderandreceiverloops inChannelfor better robustness and to properly drain the send queue on closure, fixing potential deadlocks.