feat: guard new 504/524 status remaps with risk confirmation

This commit is contained in:
Seefs
2026-02-22 20:03:46 +08:00
parent 06fc6015bb
commit 50ffa639a2
11 changed files with 419 additions and 2 deletions

View File

@@ -26,6 +26,11 @@ var AutomaticRetryStatusCodeRanges = []StatusCodeRange{
{Start: 525, End: 599},
}
var alwaysSkipRetryStatusCodes = map[int]struct{}{
504: {},
524: {},
}
func AutomaticDisableStatusCodesToString() string {
return statusCodeRangesToString(AutomaticDisableStatusCodeRanges)
}
@@ -56,7 +61,15 @@ func AutomaticRetryStatusCodesFromString(s string) error {
return nil
}
func IsAlwaysSkipRetryStatusCode(code int) bool {
_, exists := alwaysSkipRetryStatusCodes[code]
return exists
}
func ShouldRetryByStatusCode(code int) bool {
if IsAlwaysSkipRetryStatusCode(code) {
return false
}
return shouldMatchStatusCodeRanges(AutomaticRetryStatusCodeRanges, code)
}