|
|
@@ -277,14 +277,13 @@ func shouldRetry(c *gin.Context, openaiErr *types.NewAPIError, retryTimes int) b
|
|
|
|
|
|
func processChannelError(c *gin.Context, channelError types.ChannelError, err *types.NewAPIError) {
|
|
|
logger.LogError(c, fmt.Sprintf("relay error (channel #%d, status code: %d): %s", channelError.ChannelId, err.StatusCode, err.Error()))
|
|
|
-
|
|
|
- gopool.Go(func() {
|
|
|
- // 不要使用context获取渠道信息,异步处理时可能会出现渠道信息不一致的情况
|
|
|
- // do not use context to get channel info, there may be inconsistent channel info when processing asynchronously
|
|
|
- if service.ShouldDisableChannel(channelError.ChannelId, err) && channelError.AutoBan {
|
|
|
+ // 不要使用context获取渠道信息,异步处理时可能会出现渠道信息不一致的情况
|
|
|
+ // do not use context to get channel info, there may be inconsistent channel info when processing asynchronously
|
|
|
+ if service.ShouldDisableChannel(channelError.ChannelId, err) && channelError.AutoBan {
|
|
|
+ gopool.Go(func() {
|
|
|
service.DisableChannel(channelError, err.Error())
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
if constant.ErrorLogEnabled && types.IsRecordErrorLog(err) {
|
|
|
// 保存错误日志到mysql中
|