fix: only disable channel when allowed
This commit is contained in:
parent
e54e647170
commit
7e7369dbc4
@ -178,7 +178,11 @@ func testChannels(notify bool, scope string) error {
|
|||||||
milliseconds := tok.Sub(tik).Milliseconds()
|
milliseconds := tok.Sub(tik).Milliseconds()
|
||||||
if isChannelEnabled && milliseconds > disableThreshold {
|
if isChannelEnabled && milliseconds > disableThreshold {
|
||||||
err = errors.New(fmt.Sprintf("响应时间 %.2fs 超过阈值 %.2fs", float64(milliseconds)/1000.0, float64(disableThreshold)/1000.0))
|
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) {
|
if isChannelEnabled && util.ShouldDisableChannel(openaiErr, -1) {
|
||||||
monitor.DisableChannel(channel.Id, channel.Name, err.Error())
|
monitor.DisableChannel(channel.Id, channel.Name, err.Error())
|
||||||
|
Loading…
Reference in New Issue
Block a user