feat: enhanced channel test
This commit is contained in:
parent
624c887366
commit
8b4d2773d2
@ -261,12 +261,17 @@ func testAllChannels(notify bool) error {
|
|||||||
err, openaiErr := testChannel(channel, *testRequest)
|
err, openaiErr := testChannel(channel, *testRequest)
|
||||||
tok := time.Now()
|
tok := time.Now()
|
||||||
milliseconds := tok.Sub(tik).Milliseconds()
|
milliseconds := tok.Sub(tik).Milliseconds()
|
||||||
|
channelBeninDisabled := false
|
||||||
if milliseconds > disableThreshold {
|
if 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))
|
||||||
disableChannel(channel.Id, channel.Name, err.Error())
|
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())
|
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)
|
enableChannel(channel.Id, channel.Name)
|
||||||
}
|
}
|
||||||
channel.UpdateResponseTime(milliseconds)
|
channel.UpdateResponseTime(milliseconds)
|
||||||
|
Loading…
Reference in New Issue
Block a user