@@ -2369,6 +2369,10 @@ static int http_request_reauth(const char *url,
23692369 if (ret != HTTP_OK && ret != HTTP_REAUTH && ret != HTTP_RATE_LIMITED )
23702370 return ret ;
23712371
2372+ /* If retries are disabled and we got a 429, fail immediately */
2373+ if (ret == HTTP_RATE_LIMITED && http_max_retries == 0 )
2374+ return HTTP_ERROR ;
2375+
23722376 if (options && options -> effective_url && options -> base_url ) {
23732377 if (update_url_from_redirect (options -> base_url ,
23742378 url , options -> effective_url )) {
@@ -2405,11 +2409,6 @@ static int http_request_reauth(const char *url,
24052409
24062410 if (ret == HTTP_RATE_LIMITED ) {
24072411 /* Handle rate limiting with retry logic */
2408- int retry_attempt = http_max_retries - rate_limit_retries + 1 ;
2409-
2410- trace2_data_intmax ("http" , the_repository , "http/429-retry-attempt" ,
2411- retry_attempt );
2412-
24132412 if (rate_limit_retries <= 0 ) {
24142413 /* Retries are disabled or exhausted */
24152414 if (http_max_retries > 0 ) {
@@ -2420,6 +2419,11 @@ static int http_request_reauth(const char *url,
24202419 return HTTP_ERROR ;
24212420 }
24222421
2422+ int retry_attempt = http_max_retries - rate_limit_retries + 1 ;
2423+
2424+ trace2_data_intmax ("http" , the_repository , "http/429-retry-attempt" ,
2425+ retry_attempt );
2426+
24232427 /* Decrement retries counter */
24242428 rate_limit_retries -- ;
24252429
0 commit comments