From d79a7b5902b6f88a896ece05aaecb10a036ddf65 Mon Sep 17 00:00:00 2001 From: ckt <65409152+ckt1031@users.noreply.github.com> Date: Sun, 22 Oct 2023 10:46:54 +0000 Subject: [PATCH] fix; channel testing --- controller/channel-test.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/controller/channel-test.go b/controller/channel-test.go index 3db2a24e..956b67e7 100644 --- a/controller/channel-test.go +++ b/controller/channel-test.go @@ -253,7 +253,7 @@ func testAllChannels(notify bool) error { } go func() { for _, channel := range channels { - if channel.Status != common.ChannelStatusEnabled || (channel.Status == common.ChannelStatusAutoDisabled && common.AutoReEnableFailedChannelEnabled) { + if channel.Status == common.ChannelStatusManuallyDisabled || channel.Status == common.ChannelStatusUnknown { continue } tik := time.Now() @@ -264,11 +264,9 @@ func testAllChannels(notify bool) error { 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()) - } - if shouldDisableChannel(openaiErr, -1) { + } else if shouldDisableChannel(openaiErr, -1) { disableChannel(channel.Id, channel.Name, err.Error()) - } - if channel.Status == common.ChannelStatusAutoDisabled && common.AutoReEnableFailedChannelEnabled { + } else if channel.Status == common.ChannelStatusAutoDisabled && common.AutoReEnableFailedChannelEnabled { enableChannel(channel.Id, channel.Name) } channel.UpdateResponseTime(milliseconds)