From 7e7369dbc449d39923dcda376e02b624ab953848 Mon Sep 17 00:00:00 2001 From: JustSong Date: Sun, 10 Mar 2024 23:41:16 +0800 Subject: [PATCH] fix: only disable channel when allowed --- controller/channel-test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/controller/channel-test.go b/controller/channel-test.go index f709a6df..6d18305a 100644 --- a/controller/channel-test.go +++ b/controller/channel-test.go @@ -178,7 +178,11 @@ func testChannels(notify bool, scope string) error { milliseconds := tok.Sub(tik).Milliseconds() if isChannelEnabled && milliseconds > disableThreshold { err = errors.New(fmt.Sprintf("响应时间 %.2fs 超过阈值 %.2fs", float64(milliseconds)/1000.0, float64(disableThreshold)/1000.0)) - monitor.DisableChannel(channel.Id, channel.Name, err.Error()) + if config.AutomaticDisableChannelEnabled { + monitor.DisableChannel(channel.Id, channel.Name, err.Error()) + } else { + _ = message.Notify(message.ByAll, fmt.Sprintf("渠道 %s (%d)测试超时", channel.Name, channel.Id), "", err.Error()) + } } if isChannelEnabled && util.ShouldDisableChannel(openaiErr, -1) { monitor.DisableChannel(channel.Id, channel.Name, err.Error())