mirror of
https://github.com/minio/minio.git
synced 2025-01-24 05:03:16 -05:00
fix; change retry-after 60sec for 503s and 10s for 429s (#19996)
This commit is contained in:
parent
5e7b243bde
commit
b35d083872
@ -946,10 +946,20 @@ func writeSuccessResponseHeadersOnly(w http.ResponseWriter) {
|
|||||||
|
|
||||||
// writeErrorResponse writes error headers
|
// writeErrorResponse writes error headers
|
||||||
func writeErrorResponse(ctx context.Context, w http.ResponseWriter, err APIError, reqURL *url.URL) {
|
func writeErrorResponse(ctx context.Context, w http.ResponseWriter, err APIError, reqURL *url.URL) {
|
||||||
if err.HTTPStatusCode == http.StatusServiceUnavailable {
|
switch err.HTTPStatusCode {
|
||||||
// Set retry-after header to indicate user-agents to retry request after 120secs.
|
case http.StatusServiceUnavailable:
|
||||||
|
// Set retry-after header to indicate user-agents to retry request after 60 seconds.
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
||||||
w.Header().Set(xhttp.RetryAfter, "120")
|
w.Header().Set(xhttp.RetryAfter, "60")
|
||||||
|
case http.StatusTooManyRequests:
|
||||||
|
_, deadline := globalAPIConfig.getRequestsPool()
|
||||||
|
if deadline <= 0 {
|
||||||
|
// Set retry-after header to indicate user-agents to retry request after 10 seconds.
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After
|
||||||
|
w.Header().Set(xhttp.RetryAfter, "10")
|
||||||
|
} else {
|
||||||
|
w.Header().Set(xhttp.RetryAfter, strconv.Itoa(int(deadline.Seconds())))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch err.Code {
|
switch err.Code {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user