From 737534a36b4f4a4bb7f65f6039369333493515ba Mon Sep 17 00:00:00 2001 From: MyronZhang Date: Tue, 11 Feb 2025 18:44:41 +0800 Subject: [PATCH] fix manage channel --- controller/channel-test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controller/channel-test.go b/controller/channel-test.go index 3894691c..05dcd4ad 100644 --- a/controller/channel-test.go +++ b/controller/channel-test.go @@ -251,10 +251,10 @@ func testChannels(ctx context.Context, notify bool, scope string) error { _ = message.Notify(message.ByAll, fmt.Sprintf("渠道 %s (%d)测试超时", channel.Name, channel.Id), "", err.Error()) } } - if isChannelEnabled && monitor.ShouldDisableChannel(openaiErr, -1) { + if isChannelEnabled && (err != nil || monitor.ShouldDisableChannel(openaiErr, -1)) { monitor.DisableChannel(channel.Id, channel.Name, err.Error()) } - if !isChannelEnabled && monitor.ShouldEnableChannel(err, openaiErr) { + if !isChannelEnabled && (err == nil && monitor.ShouldEnableChannel(err, openaiErr)) { monitor.EnableChannel(channel.Id, channel.Name) } channel.UpdateResponseTime(milliseconds)