Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @hzxuzhonghu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request focuses on internal code cleanups and refactoring within the orion-lib crate. Key changes include abstracting functionality in HttpChannelBuilder for better maintainability and removing a custom TokioExecutor implementation in favor of the one provided by hyper_util, streamlining dependency usage.
Highlights
- Refactor HttpChannelBuilder: The
HttpChannelBuilderstruct has been enhanced with aDefaultimplementation, and itsbuildmethod has been refactored into two new private helper methods:configure_hyper_clientandconfigure_http2_if_needed. This improves modularity and readability by encapsulating client configuration logic. - Consolidate TokioExecutor usage: The custom
TokioExecutorpreviously defined inorion-lib/src/utils.rshas been removed. All instances now directly utilize theTokioExecutorprovided by thehyper_utilcrate, simplifying the project's runtime executor management and reducing redundant code.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Pull Request Overview
This PR performs cleanup operations by refactoring the HttpChannelBuilder class and removing a custom TokioExecutor implementation in favor of using the one provided by hyper. The changes improve code organization and eliminate duplicate functionality.
- Refactored HttpChannelBuilder to use the Default trait and extracted HTTP client configuration into separate methods
- Removed custom TokioExecutor implementation and switched to using hyper_util::rt::TokioExecutor
- Consolidated import statements and improved code structure
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| orion-lib/src/utils.rs | Removed entire file containing custom TokioExecutor implementation |
| orion-lib/src/transport/http_channel.rs | Refactored HttpChannelBuilder with Default trait, extracted configuration methods, and switched to hyper's TokioExecutor |
| orion-lib/src/listeners/filterchain.rs | Updated import and usage of TokioExecutor from hyper_util |
| orion-lib/src/lib.rs | Removed utils module reference |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| } else { | ||
| let server_name = ServerName::try_from(authority.host().to_owned())?; | ||
| debug!("Server name is not configured in boostrap.. using endpoint authority {:?}", server_name); | ||
| debug!("Server name is not configured in bootstrap.. using endpoint authority {:?}", server_name); |
There was a problem hiding this comment.
Fixed typo: 'boostrap' should be 'bootstrap'
| debug!("Server name is not configured in bootstrap.. using endpoint authority {:?}", server_name); | |
| debug!("Server name is not configured.. using endpoint authority {:?}", server_name); |
There was a problem hiding this comment.
Code Review
This pull request performs some useful cleanups. It refactors HttpChannelBuilder by abstracting several functions, which improves code structure and readability. It also removes a private TokioExecutor implementation in favor of the one from hyper-util, which is a good move towards using standard library components.
I have found one significant issue regarding a misconfiguration of an HTTP/2 parameter where a fixme comment was removed but the underlying problem persists. Please see my detailed comment.
| if let Some(max) = http2_options.max_concurrent_streams() { | ||
| client_builder.http2_max_concurrent_reset_streams(max); | ||
| } |
There was a problem hiding this comment.
The configuration option http2_options.max_concurrent_streams() is being used to set http2_max_concurrent_reset_streams. These are two distinct HTTP/2 settings. max_concurrent_streams controls the maximum number of concurrent streams, while max_concurrent_reset_streams limits how many streams can be reset by the client, as a denial-of-service protection.
Using the value for one to configure the other is a bug and will lead to unexpected behavior. The fixme comment that pointed this out was removed in this refactoring, but the issue remains.
To fix this, the field in Http2ProtocolOptions should be renamed to max_concurrent_reset_streams to accurately reflect what is being configured. Since that file is not part of this PR, you should at least restore the //fixme comment to track this issue.
faa9609 to
d136835
Compare
Signed-off-by: Zhonghu Xu <xuzhonghu@huawei.com>
|
/lgtm |
|
/approved |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dawid-nowak The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Misc Cleanups
This patch does some cleanups