-
Notifications
You must be signed in to change notification settings - Fork 252
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
refactor: http #2386
refactor: http #2386
Conversation
src/cli/runtime/http.rs
Outdated
@@ -182,8 +183,41 @@ impl HttpIO for NativeHttp { | |||
) | |||
.await?) | |||
} | |||
|
|||
fn cl(&self) -> Box<dyn HttpIO> { | |||
Box::new(self.clone()) |
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.
Cloning isn't going to help, ideally we want to create separate connection pools and caches for each http-client.
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.
I have a question about this. According to https://docs.rs/reqwest/0.12.5/reqwest/struct.Client.html
, reqwest::Client
has a connection pool in it already. Do we need more work?
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.
Nothing special needs to be done for pooling.
src/cli/runtime/http.rs
Outdated
if let Some(http) = self.map.get(&thread_id) { | ||
http.value().execute(request).await | ||
} else { | ||
let new_http = self.http.cl(); |
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.
Should call init_http
instead.
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.
Ok
src/cli/runtime/http.rs
Outdated
|
||
pub struct ConcurrentHttp { | ||
http: Box<dyn HttpIO>, | ||
map: DashMap<std::thread::ThreadId, Box<dyn HttpIO>>, |
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.
instead of map we can use a thread local.
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.
Ok
Bencher
Click to view all benchmark results
Bencher - Continuous Benchmarking View Public Perf Page Docs | Repo | Chat | Help |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2386 +/- ##
=======================================
Coverage 87.26% 87.27%
=======================================
Files 243 243
Lines 22524 22531 +7
=======================================
+ Hits 19656 19663 +7
Misses 2868 2868 ☔ View full report in Codecov by Sentry. |
Moving to draft to reduce noise and improve CI efficiency. Once you are ready just mark it as "ready to review". Feel free to give a shoutout on the #contributors channel on Discord if you want immediate attention. Let me know once the comments are fixed. Thanks! |
@tusharmath I think it's ok now. But the CI of benchmark went wrong. |
@Shylock-Hg The PR isn't doing whats expected:
For these reasons, I am closing this PR for now. Feel free to create a new PR and ask questions on discord if the requirement isn't clear, always happy to help! |
Ok, I misunderstand it |
Summary:
Create http for each thread
Issue Reference(s):
Close #2370
/claim #2370
Build & Testing:
cargo test
successfully../lint.sh --mode=fix
to fix all linting issues raised by./lint.sh --mode=check
.Checklist:
<type>(<optional scope>): <title>