Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
0c528095
Commit
0c528095
authored
Jan 11, 2026
by
ianshaw
Browse files
refactor(settings): 简化流超时配置,移除冗余字段
- 移除 TimeoutSeconds 字段,超时判定由网关配置控制 - 默认禁用流超时处理功能
parent
2a0758bd
Changes
5
Hide whitespace changes
Inline
Side-by-side
backend/internal/handler/admin/setting_handler.go
View file @
0c528095
...
...
@@ -666,7 +666,6 @@ func (h *SettingHandler) GetStreamTimeoutSettings(c *gin.Context) {
response
.
Success
(
c
,
dto
.
StreamTimeoutSettings
{
Enabled
:
settings
.
Enabled
,
TimeoutSeconds
:
settings
.
TimeoutSeconds
,
Action
:
settings
.
Action
,
TempUnschedMinutes
:
settings
.
TempUnschedMinutes
,
ThresholdCount
:
settings
.
ThresholdCount
,
...
...
@@ -677,7 +676,6 @@ func (h *SettingHandler) GetStreamTimeoutSettings(c *gin.Context) {
// UpdateStreamTimeoutSettingsRequest 更新流超时配置请求
type
UpdateStreamTimeoutSettingsRequest
struct
{
Enabled
bool
`json:"enabled"`
TimeoutSeconds
int
`json:"timeout_seconds"`
Action
string
`json:"action"`
TempUnschedMinutes
int
`json:"temp_unsched_minutes"`
ThresholdCount
int
`json:"threshold_count"`
...
...
@@ -695,7 +693,6 @@ func (h *SettingHandler) UpdateStreamTimeoutSettings(c *gin.Context) {
settings
:=
&
service
.
StreamTimeoutSettings
{
Enabled
:
req
.
Enabled
,
TimeoutSeconds
:
req
.
TimeoutSeconds
,
Action
:
req
.
Action
,
TempUnschedMinutes
:
req
.
TempUnschedMinutes
,
ThresholdCount
:
req
.
ThresholdCount
,
...
...
@@ -716,7 +713,6 @@ func (h *SettingHandler) UpdateStreamTimeoutSettings(c *gin.Context) {
response
.
Success
(
c
,
dto
.
StreamTimeoutSettings
{
Enabled
:
updatedSettings
.
Enabled
,
TimeoutSeconds
:
updatedSettings
.
TimeoutSeconds
,
Action
:
updatedSettings
.
Action
,
TempUnschedMinutes
:
updatedSettings
.
TempUnschedMinutes
,
ThresholdCount
:
updatedSettings
.
ThresholdCount
,
...
...
backend/internal/handler/dto/settings.go
View file @
0c528095
...
...
@@ -70,7 +70,6 @@ type PublicSettings struct {
// StreamTimeoutSettings 流超时处理配置 DTO
type
StreamTimeoutSettings
struct
{
Enabled
bool
`json:"enabled"`
TimeoutSeconds
int
`json:"timeout_seconds"`
Action
string
`json:"action"`
TempUnschedMinutes
int
`json:"temp_unsched_minutes"`
ThresholdCount
int
`json:"threshold_count"`
...
...
backend/internal/service/setting_service.go
View file @
0c528095
...
...
@@ -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"
)
}
...
...
backend/internal/service/settings_view.go
View file @
0c528095
...
...
@@ -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
,
...
...
frontend/src/api/admin/settings.ts
View file @
0c528095
...
...
@@ -206,7 +206,6 @@ export async function deleteAdminApiKey(): Promise<{ message: string }> {
*/
export
interface
StreamTimeoutSettings
{
enabled
:
boolean
timeout_seconds
:
number
action
:
'
temp_unsched
'
|
'
error
'
|
'
none
'
temp_unsched_minutes
:
number
threshold_count
:
number
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment