refactor: replace reqwest with hyper-util and add client pooling#298
refactor: replace reqwest with hyper-util and add client pooling#298
reqwest with hyper-util and add client pooling#298Conversation
8badd9d to
b21f976
Compare
|
@greptileai review this draft |
Greptile OverviewGreptile SummaryReplaced the Key Changes:
The pooling implementation correctly tracks active requests via Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant App as Application
participant API as api.rs (BaseClient)
participant Pool as client::Pool
participant HostPool as client::HostPool
participant Client as HyperClient
participant Server as S2 Server
App->>API: execute_unary(request)
API->>Pool: checkout(host)
Pool->>HostPool: get_or_create_host_pool(host)
HostPool->>HostPool: check existing clients for capacity
alt Client has capacity
HostPool->>HostPool: request_permit() ✓
HostPool-->>Pool: (client, permit)
else All clients full
HostPool->>HostPool: create_client()
HostPool->>HostPool: request_permit() ✓
HostPool-->>Pool: (new_client, permit)
end
Pool-->>API: (client, _permit)
API->>Client: request(http_request)
Client->>Server: HTTP Request
Server-->>Client: HTTP Response
Client-->>API: UnaryResponse
API->>API: decompress_body()
API-->>App: Result<UnaryResponse>
Note over API,Pool: _permit dropped, active_requests--
App->>API: init_streaming(request)
API->>Pool: checkout(host)
Pool->>HostPool: checkout()
HostPool-->>Pool: (client, permit)
Pool-->>API: (client, permit)
API->>Client: request(http_request)
Client->>Server: HTTP Request (streaming)
Server-->>Client: HTTP Response Stream
Client-->>API: StreamingResponse{body, permit}
API-->>App: StreamingResponse
Note over App,API: permit held until stream consumed
App->>App: consume stream frames
App->>App: drop StreamingResponse
Note over API,Pool: permit dropped, active_requests--
|
5614b52 to
deab6bc
Compare
|
@greptileai review this draft again and list what you'd like to see to improve your confidence |
|
Based on reviewing this draft PR (1,300 additions, 705 deletions across 8 files), here's what would improve my confidence: High Priority
Medium Priority
Would Be Nice
The resolved comment about |
reqwest with hyper-util and add client pooling
|
@greptileai can you update your review as files have changed since your first review |
|
@greptileai i've responded to your comments. can you review again? |
4a89492 to
b7e5091
Compare
b7e5091 to
575d275
Compare
|
@greptileai i've responded to your comments. can you review again? |
Additional Comments (1)
Prompt To Fix With AIThis is a comment left during a code review.
Path: src/api.rs
Line: 569:572
Comment:
**Overbroad retry classification**
`ClientError::is_retryable` returns `true` for everything except `Others`, which makes `Timeout`, `RequestCanceled`, and `ConnectionClosedEarly` retryable. With the new `client::Error` mapping, `RequestCanceled` can occur when the client-side timeout fires (`tokio::time::timeout` aborts the request future), so timeouts/cancels may be retried even when they are deterministic under current load/timeout settings. This changes retry behavior vs. the prior reqwest-based classification; consider tightening `is_retryable` to avoid retrying timeouts/cancellations if that’s not intended for this SDK.
How can I resolve this? If you propose a fix, please make it concise. |
|
@greptileai |
## 🤖 New release
* `s2-sdk`: 0.23.8 -> 0.24.0 (⚠ API breaking changes)
### ⚠ `s2-sdk` breaking changes
```text
--- failure inherent_method_missing: pub method removed or renamed ---
Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/inherent_method_missing.ron
Failed in:
CreateBasinInput::with_idempotency_token, previously in file /tmp/.tmpoNf48h/s2-sdk/src/types.rs:913
CreateStreamInput::with_idempotency_token, previously in file /tmp/.tmpoNf48h/s2-sdk/src/types.rs:2583
--- failure struct_pub_field_missing: pub struct's pub field removed or renamed ---
Description:
A publicly-visible struct has at least one public field that is no longer available under its prior name. It may have been renamed or removed entirely.
ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/struct_pub_field_missing.ron
Failed in:
field idempotency_token of struct CreateBasinInput, previously in file /tmp/.tmpoNf48h/s2-sdk/src/types.rs:882
field idempotency_token of struct CreateStreamInput, previously in file /tmp/.tmpoNf48h/s2-sdk/src/types.rs:2561
--- failure struct_pub_field_now_doc_hidden: pub struct field is now #[doc(hidden)] ---
Description:
A pub field of a pub struct is now marked #[doc(hidden)] and is no longer part of the public API.
ref: https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html#hidden
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/struct_pub_field_now_doc_hidden.ron
Failed in:
field CreateBasinInput.idempotency_token in file /tmp/.tmp5yfqnq/s2-sdk-rust/src/types.rs:868
field CreateStreamInput.idempotency_token in file /tmp/.tmp5yfqnq/s2-sdk-rust/src/types.rs:2539
```
<details><summary><i><b>Changelog</b></i></summary><p>
<blockquote>
## [0.24.0] - 2026-02-15
### Features
- Add accessors for `AppendRecord`
([#305](#305))
- [**breaking**] Add lower bounds for `max_batch_bytes` and
`max_batch_records`
([#309](#309))
- [**breaking**] Reduce default `max_unacked_bytes` to `5MiB`
([#311](#311))
### Refactor
- Replace `reqwest` with `hyper-util` and add client pooling
([#298](#298))
- [**breaking**] Make `idempotency_token` private
([#306](#306))
- [**breaking**] Remove unnecessary `Result` from
`with_max_unacked_batches`
([#307](#307))
- Remove unnecessary compression for GET and DELETE requests
([#308](#308))
- Rename fields, methods, and vars related to `RetryBackoff`
([#310](#310))
- [**breaking**] Make `S2DateTime` conversion from
`time::OffsetDateTime` fallible
([#312](#312))
### Testing
- Metrics
([#297](#297))
- Basin & stream api
([#300](#300))
### Miscellaneous Tasks
- Bump dependencies
([#296](#296))
- Dep updates
([#314](#314))
<!-- generated by git-cliff -->
</blockquote>
</p></details>
---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
No description provided.