fix(rate-limit): make 429 fallback cooldown configurable
This commit is contained in:
@@ -380,6 +380,14 @@ type OverloadCooldownSettings struct {
|
||||
CooldownMinutes int `json:"cooldown_minutes"`
|
||||
}
|
||||
|
||||
// RateLimit429CooldownSettings 429默认回避配置
|
||||
type RateLimit429CooldownSettings struct {
|
||||
// Enabled 是否在无法解析上游重置时间时应用默认429回避
|
||||
Enabled bool `json:"enabled"`
|
||||
// CooldownSeconds 默认回避时长(秒)
|
||||
CooldownSeconds int `json:"cooldown_seconds"`
|
||||
}
|
||||
|
||||
// DefaultOverloadCooldownSettings 返回默认的过载冷却配置(启用,10分钟)
|
||||
func DefaultOverloadCooldownSettings() *OverloadCooldownSettings {
|
||||
return &OverloadCooldownSettings{
|
||||
@@ -388,6 +396,14 @@ func DefaultOverloadCooldownSettings() *OverloadCooldownSettings {
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultRateLimit429CooldownSettings 返回默认的429回避配置(启用,5秒)
|
||||
func DefaultRateLimit429CooldownSettings() *RateLimit429CooldownSettings {
|
||||
return &RateLimit429CooldownSettings{
|
||||
Enabled: true,
|
||||
CooldownSeconds: 5,
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultBetaPolicySettings 返回默认的 Beta 策略配置
|
||||
func DefaultBetaPolicySettings() *BetaPolicySettings {
|
||||
return &BetaPolicySettings{
|
||||
|
||||
Reference in New Issue
Block a user