Merge pull request #726 from DaydreamCoding/feat/dual-mode-umq
feat(gateway): 双模式用户消息队列 — 串行队列 + 软性限速
This commit is contained in:
@@ -1109,7 +1109,7 @@ func (s *SettingService) GetMinClaudeCodeVersion(ctx context.Context) string {
|
||||
}
|
||||
}
|
||||
// singleflight: 同一时刻只有一个 goroutine 查询 DB,其余复用结果
|
||||
result, _, _ := minVersionSF.Do("min_version", func() (any, error) {
|
||||
result, err, _ := minVersionSF.Do("min_version", func() (any, error) {
|
||||
// 二次检查,避免排队的 goroutine 重复查询
|
||||
if cached, ok := minVersionCache.Load().(*cachedMinVersion); ok {
|
||||
if time.Now().UnixNano() < cached.expiresAt {
|
||||
@@ -1135,10 +1135,14 @@ func (s *SettingService) GetMinClaudeCodeVersion(ctx context.Context) string {
|
||||
})
|
||||
return value, nil
|
||||
})
|
||||
if s, ok := result.(string); ok {
|
||||
return s
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return ""
|
||||
ver, ok := result.(string)
|
||||
if !ok {
|
||||
return ""
|
||||
}
|
||||
return ver
|
||||
}
|
||||
|
||||
// SetStreamTimeoutSettings 设置流超时处理配置
|
||||
|
||||
Reference in New Issue
Block a user