MCPcopy Create free account
hub / github.com/git/git / handle_rate_limit_retry

Function handle_rate_limit_retry

http.c:2373–2401  ·  view source on GitHub ↗

* Compute the retry delay for an HTTP 429 response. * Returns a negative value if configuration is invalid (delay exceeds * http.maxRetryTime), otherwise returns the delay in seconds (>= 0). */

Source from the content-addressed store, hash-verified

2371 * http.maxRetryTime), otherwise returns the delay in seconds (>= 0).
2372 */
2373static long handle_rate_limit_retry(long slot_retry_after)
2374{
2375 /* Use the slot-specific retry_after value or configured default */
2376 if (slot_retry_after >= 0) {
2377 /* Check if retry delay exceeds maximum allowed */
2378 if (slot_retry_after > http_max_retry_time) {
2379 error(_("response requested a delay greater than http.maxRetryTime (%ld > %ld seconds)"),
2380 slot_retry_after, http_max_retry_time);
2381 trace2_data_string("http", the_repository,
2382 "http/429-error", "exceeds-max-retry-time");
2383 trace2_data_intmax("http", the_repository,
2384 "http/429-requested-delay", slot_retry_after);
2385 return -1;
2386 }
2387 return slot_retry_after;
2388 } else {
2389 /* No Retry-After header provided, use configured default */
2390 if (http_retry_after > http_max_retry_time) {
2391 error(_("configured http.retryAfter exceeds http.maxRetryTime (%ld > %ld seconds)"),
2392 http_retry_after, http_max_retry_time);
2393 trace2_data_string("http", the_repository,
2394 "http/429-error", "config-exceeds-max-retry-time");
2395 return -1;
2396 }
2397 trace2_data_string("http", the_repository,
2398 "http/429-retry-source", "config-default");
2399 return http_retry_after;
2400 }
2401}
2402
2403static int http_request_recoverable(const char *url,
2404 void *result, int target,

Callers 1

http_request_recoverableFunction · 0.85

Calls 1

errorFunction · 0.85

Tested by

no test coverage detected