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

@@ -64,7 +64,9 @@ func (r *usageCleanupRepository) ListTasks(ctx context.Context, params paginatio
if err != nil {
return nil, nil, err
}
defer rows.Close()
defer func() {
_ = rows.Close()
}()
tasks := make([]service.UsageCleanupTask, 0)
for rows.Next() {
@@ -295,7 +297,9 @@ func (r *usageCleanupRepository) DeleteUsageLogsBatch(ctx context.Context, filte
if err != nil {
return 0, err
}
defer rows.Close()
defer func() {
_ = rows.Close()
}()
var deleted int64
for rows.Next() {
@@ -357,7 +361,6 @@ func buildUsageCleanupWhere(filters service.UsageCleanupFilters) (string, []any)
if filters.BillingType != nil {
conditions = append(conditions, fmt.Sprintf("billing_type = $%d", idx))
args = append(args, *filters.BillingType)
idx++
}
return strings.Join(conditions, " AND "), args
}