diff --git a/controller/channel-test.go b/controller/channel-test.go index 956b67e7..0d8892b2 100644 --- a/controller/channel-test.go +++ b/controller/channel-test.go @@ -261,12 +261,17 @@ func testAllChannels(notify bool) error { err, openaiErr := testChannel(channel, *testRequest) tok := time.Now() milliseconds := tok.Sub(tik).Milliseconds() + channelBeninDisabled := false if milliseconds > disableThreshold { err = errors.New(fmt.Sprintf("响应时间 %.2fs 超过阈值 %.2fs", float64(milliseconds)/1000.0, float64(disableThreshold)/1000.0)) disableChannel(channel.Id, channel.Name, err.Error()) - } else if shouldDisableChannel(openaiErr, -1) { + channelBeninDisabled = true + } + if shouldDisableChannel(openaiErr, -1) { disableChannel(channel.Id, channel.Name, err.Error()) - } else if channel.Status == common.ChannelStatusAutoDisabled && common.AutoReEnableFailedChannelEnabled { + channelBeninDisabled = true + } + if channel.Status == common.ChannelStatusAutoDisabled && common.AutoReEnableFailedChannelEnabled && !channelBeninDisabled { enableChannel(channel.Id, channel.Name) } channel.UpdateResponseTime(milliseconds)