Skip to content

Comments

Refactor uv retrayble strategy to use a single code path#17099

Merged
konstin merged 1 commit intomainfrom
konsti/better-retry-handling-3
Dec 18, 2025
Merged

Refactor uv retrayble strategy to use a single code path#17099
konstin merged 1 commit intomainfrom
konsti/better-retry-handling-3

Conversation

@konstin
Copy link
Member

@konstin konstin commented Dec 12, 2025

Refactoring that allows uv's retryable strategy to return Some(Retryable::Fatal), also helpful for #16245

@konstin konstin added the internal A refactor or improvement that is not user-facing label Dec 12, 2025
@konstin konstin temporarily deployed to uv-test-registries December 12, 2025 11:35 — with GitHub Actions Inactive
@konstin konstin marked this pull request as draft December 12, 2025 12:43
/// * When streaming a response, a reqwest error may be hidden several layers behind errors
/// of different crates processing the stream, including `io::Error` layers.
pub fn is_transient_network_error(err: &(dyn Error + 'static)) -> bool {
fn uv_retryable_strategy(err: &(dyn Error + 'static)) -> Option<Retryable> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this documentation for this function up-to-date still?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated it

let retryable = match res {
Ok(success) => default_on_request_success(success),
// The uv retryable strategy contains `default_on_request_failure`
Err(err) => uv_retryable_strategy(err),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename this to retryable_on_request_failure for consistency with the reqwest_retry naming?

default => default,
let retryable = match res {
Ok(success) => default_on_request_success(success),
// The uv retryable strategy contains `default_on_request_failure`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This this comment just be on the uv_retryable_strategy doc comment? I think it makes more sense there?

@konstin konstin force-pushed the konsti/better-retry-handling-3 branch from b76ab5b to 1e18331 Compare December 12, 2025 14:36
@konstin konstin temporarily deployed to uv-test-registries December 12, 2025 14:39 — with GitHub Actions Inactive
Base automatically changed from konsti/better-retry-handling-2 to main December 12, 2025 17:02
Refactoring that allows uv's retryable strategy to return Some(Retryable::Fatal), which is also helpful for #16245.

We need to change the way we're reporting retries to avoid both the retry middleware and our own retry context to report the retry numbers.
@konstin konstin force-pushed the konsti/better-retry-handling-3 branch from 1e18331 to 7571ffa Compare December 15, 2025 13:31
@konstin konstin marked this pull request as ready for review December 15, 2025 13:31
@konstin konstin temporarily deployed to uv-test-registries December 15, 2025 15:20 — with GitHub Actions Inactive
@konstin konstin requested a review from zanieb December 16, 2025 09:48
Copy link
Contributor

@EliteTK EliteTK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked at this in the context of the other changes and in the context of what I've learned about this code yesterday/today. Looks good from my end.

@konstin konstin merged commit 9360ca7 into main Dec 18, 2025
191 of 192 checks passed
@konstin konstin deleted the konsti/better-retry-handling-3 branch December 18, 2025 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal A refactor or improvement that is not user-facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants