feat(认证): 启用 OpenAI OAuth HTTP/2 并修复清理任务 lint

为共享 req 客户端增加 HTTP/2 选项与缓存隔离
OpenAI OAuth 超时提升到 120s,并按协议控制强制
新增客户端池与 OAuth 客户端单测覆盖
修复 usage cleanup 相关 errcheck/ineffassign/staticcheck 并统一格式

测试: make test
This commit is contained in:
yangjianbo
2026-01-19 19:50:57 +08:00
parent ef5a41057f
commit 73e6b160f8
9 changed files with 144 additions and 13 deletions

View File

@@ -151,6 +151,9 @@ func (s *UsageCleanupService) CreateTask(ctx context.Context, filters UsageClean
}
func (s *UsageCleanupService) runOnce() {
if s == nil {
return
}
if !atomic.CompareAndSwapInt32(&s.running, 0, 1) {
log.Printf("[UsageCleanup] run_once skipped: already_running=true")
return
@@ -158,7 +161,7 @@ func (s *UsageCleanupService) runOnce() {
defer atomic.StoreInt32(&s.running, 0)
parent := context.Background()
if s != nil && s.workerCtx != nil {
if s.workerCtx != nil {
parent = s.workerCtx
}
ctx, cancel := context.WithTimeout(parent, s.taskTimeout())