-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Only perform fetches of credentials for a realm once #3237
Conversation
e56d2e6
to
cff76b1
Compare
/// A cache per realm and username | ||
realms: Mutex<HashMap<(Realm, Username), Arc<Credentials>>>, | ||
/// A cache tracking the result of fetches from external services | ||
pub(crate) fetches: OnceMap<(Realm, Username), Option<Arc<Credentials>>>, |
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.
This duplication hints that we should refactor the realm
cache but I don't want to make further changes here.
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.
pub(crate)
seems slightly off but perhaps not worth exposing these as methods.
# Conflicts: # crates/uv-auth/Cargo.toml
cff76b1
to
b5d1d77
Compare
Going to do some sort of light benchmarking. |
Looks helpful for large requirements. Note for all of these I seeded a clean environment first to ensure there wasn't an extra cost for the first invocation.
|
Closes #3205
Tested with
RUST_LOG=uv=trace cargo run -- pip install -r scripts/requirements/trio.in --index-url https://oauth2accesstoken@us-central1-python.pkg.dev/zb-test-project-421213/pypyi/simple/ --no-cache --keyring-provider subprocess -vv --reinstall 2>&1 | grep keyring
On
main
you can see a dozen keyring attempts at once. Here, the other requests wait for the first attempt and only a single keyring call is performed.