refactor(settings): 简化流超时配置,移除冗余字段
- 移除 TimeoutSeconds 字段,超时判定由网关配置控制 - 默认禁用流超时处理功能
This commit is contained in:
@@ -696,15 +696,6 @@ func (s *SettingService) GetStreamTimeoutSettings(ctx context.Context) (*StreamT
|
||||
}
|
||||
|
||||
// 验证并修正配置值
|
||||
if settings.TimeoutSeconds < 0 {
|
||||
settings.TimeoutSeconds = 0
|
||||
}
|
||||
if settings.TimeoutSeconds > 0 && settings.TimeoutSeconds < 30 {
|
||||
settings.TimeoutSeconds = 30
|
||||
}
|
||||
if settings.TimeoutSeconds > 300 {
|
||||
settings.TimeoutSeconds = 300
|
||||
}
|
||||
if settings.TempUnschedMinutes < 1 {
|
||||
settings.TempUnschedMinutes = 1
|
||||
}
|
||||
@@ -742,12 +733,6 @@ func (s *SettingService) SetStreamTimeoutSettings(ctx context.Context, settings
|
||||
}
|
||||
|
||||
// 验证配置值
|
||||
if settings.TimeoutSeconds < 0 {
|
||||
return fmt.Errorf("timeout_seconds must be non-negative")
|
||||
}
|
||||
if settings.TimeoutSeconds > 0 && (settings.TimeoutSeconds < 30 || settings.TimeoutSeconds > 300) {
|
||||
return fmt.Errorf("timeout_seconds must be 0 or between 30-300")
|
||||
}
|
||||
if settings.TempUnschedMinutes < 1 || settings.TempUnschedMinutes > 60 {
|
||||
return fmt.Errorf("temp_unsched_minutes must be between 1-60")
|
||||
}
|
||||
|
||||
@@ -70,12 +70,10 @@ type PublicSettings struct {
|
||||
Version string
|
||||
}
|
||||
|
||||
// StreamTimeoutSettings 流超时处理配置
|
||||
// StreamTimeoutSettings 流超时处理配置(仅控制超时后的处理方式,超时判定由网关配置控制)
|
||||
type StreamTimeoutSettings struct {
|
||||
// Enabled 是否启用流超时处理
|
||||
Enabled bool `json:"enabled"`
|
||||
// TimeoutSeconds 流数据间隔超时阈值(秒),0表示禁用
|
||||
TimeoutSeconds int `json:"timeout_seconds"`
|
||||
// Action 超时后的处理方式: "temp_unsched" | "error" | "none"
|
||||
Action string `json:"action"`
|
||||
// TempUnschedMinutes 临时不可调度持续时间(分钟)
|
||||
@@ -96,8 +94,7 @@ const (
|
||||
// DefaultStreamTimeoutSettings 返回默认的流超时配置
|
||||
func DefaultStreamTimeoutSettings() *StreamTimeoutSettings {
|
||||
return &StreamTimeoutSettings{
|
||||
Enabled: true,
|
||||
TimeoutSeconds: 60,
|
||||
Enabled: false,
|
||||
Action: StreamTimeoutActionTempUnsched,
|
||||
TempUnschedMinutes: 5,
|
||||
ThresholdCount: 3,
|
||||
|
||||
Reference in New Issue
Block a user