Add async single-flight proxy resolution#8
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a Tokio-gated asynchronous proxy-resolution API that avoids blocking async runtime workers by funneling resolution through a lazily created dedicated background thread, while coalescing identical concurrent lookups (“single-flight”) and bounding queued work.
Changes:
- Add
ProxyResolver::resolve_proxy_async(Tokio feature) implemented via a per-resolver background worker plus in-flight coalescing keyed by URL + config generation. - Expose a crate-level
resolve_proxy_asyncconvenience wrapper for the global resolver. - Update docs and add a Tokio concurrency test validating identical-call coalescing.
Show a summary per file
| File | Description |
|---|---|
src/types.rs |
Makes Error clonable to support sharing async results through channels. |
src/resolver.rs |
Implements the async worker thread, in-flight coalescing, bounded queueing, and adds a Tokio test. |
src/lib.rs |
Exposes a new Tokio-gated resolve_proxy_async wrapper on the global resolver. |
README.md |
Documents the new async API and recommended usage under the tokio feature. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 4
- Review effort level: Low
cc68100 to
935c0d0
Compare
dbaeumer
approved these changes
Jul 14, 2026
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.
Summary
resolve_proxy_asyncAPI backed by one lazy dedicated resolver threadValidation
cargo testcargo test --features tokiocargo clippy --all-targets --features tokio -- -D warningscargo fmt --all -- --check