-
Notifications
You must be signed in to change notification settings - Fork 13
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
BE-586 | OrderBookClient use slices.Split for pagination #533
BE-586 | OrderBookClient use slices.Split for pagination #533
Conversation
Cleans up OrderBookClient by reusing slices.Split instead of duplicating splitting slices into chunks logic in some of the methods.
WalkthroughThe changes in this pull request focus on the Changes
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (3)
domain/orderbook/grpcclient/orderbook_grpc_client.go (3)
92-95
: LGTM: Improved chunking logic using slices.SplitThe use of
slices.Split
simplifies the code and improves readability while maintaining the same functionality. The error message update is consistent with the new variable name.Consider wrapping the error in a custom error type for better error handling:
if err != nil { return nil, fmt.Errorf("failed to fetch unrealized cancels: %w", err) }This approach provides more context and allows for easier error checking in the calling code.
120-121
: LGTM: Consistent use of slices.Split for chunkingThe changes in
FetchTicks
are consistent with those inFetchTickUnrealizedCancels
, improving code clarity and maintainability.Consider applying the same error wrapping suggestion as in
FetchTickUnrealizedCancels
:if err != nil { return nil, fmt.Errorf("failed to fetch ticks: %w", err) }This would provide more context and allow for consistent error handling across both methods.
Line range hint
1-134
: Summary: PR objectives achieved with improved code qualityThe changes in this PR successfully achieve the stated objective of cleaning up the OrderBookClient by reusing the
slices.Split
function. The modifications eliminate duplication of chunking logic in theFetchTickUnrealizedCancels
andFetchTicks
methods, resulting in more maintainable and efficient code.Key improvements:
- Consistent use of
slices.Split
for chunking in both methods.- Improved code readability and maintainability.
- Preserved existing functionality and error handling.
Consider applying similar refactoring to other methods in the codebase that may benefit from using
slices.Split
for chunking operations. This would further improve consistency across the project.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
- domain/orderbook/grpcclient/orderbook_grpc_client.go (3 hunks)
🧰 Additional context used
🔇 Additional comments (1)
domain/orderbook/grpcclient/orderbook_grpc_client.go (1)
9-9
: LGTM: Import added for slices packageThe addition of the
slices
package import is appropriate for the subsequent use ofslices.Split
in the modified methods.
Cleans up OrderBookClient by reusing slices.Split instead of duplicating splitting slices into chunks logic in some of the methods.
Summary by CodeRabbit
New Features
Bug Fixes
Refactor