fix(ci): 修复剩余的CI错误

- 修复 ops_repo_latency_histogram_buckets.go 中另一个函数的 WriteString 未检查错误
- 修复 ops_repo_request_details.go 和 ops_repo_trends.go 中的 Rows.Close 未检查错误
- 修复 ops_alert_models.go, ops_cleanup_service.go, ops_request_details.go 的格式化问题
- 移除 ops_retry.go 中未使用的 status 字段
- 修复 maxTime 函数重复声明(将测试文件中的函数重命名为 testMaxTime)
This commit is contained in:
IanShaw027
2026-01-11 23:57:20 +08:00
parent f017fd97c1
commit 19b67e89a2
8 changed files with 23 additions and 28 deletions

View File

@@ -72,4 +72,3 @@ type OpsAlertEventFilter struct {
Platform string
GroupID *int64
}

View File

@@ -94,19 +94,19 @@ func (s *OpsCleanupService) Start() {
if parsed, err := time.LoadLocation(strings.TrimSpace(s.cfg.Timezone)); err == nil && parsed != nil {
loc = parsed
}
}
c := cron.New(cron.WithParser(opsCleanupCronParser), cron.WithLocation(loc))
_, err := c.AddFunc(schedule, func() { s.runScheduled() })
if err != nil {
log.Printf("[OpsCleanup] not started (invalid schedule=%q): %v", schedule, err)
return
}
s.cron = c
s.cron.Start()
log.Printf("[OpsCleanup] started (schedule=%q tz=%s)", schedule, loc.String())
})
}
}
c := cron.New(cron.WithParser(opsCleanupCronParser), cron.WithLocation(loc))
_, err := c.AddFunc(schedule, func() { s.runScheduled() })
if err != nil {
log.Printf("[OpsCleanup] not started (invalid schedule=%q): %v", schedule, err)
return
}
s.cron = c
s.cron.Start()
log.Printf("[OpsCleanup] started (schedule=%q tz=%s)", schedule, loc.String())
})
}
func (s *OpsCleanupService) Stop() {
if s == nil {

View File

@@ -149,4 +149,3 @@ func (s *OpsService) ListRequestDetails(ctx context.Context, filter *OpsRequestD
PageSize: pageSize,
}, nil
}

View File

@@ -52,7 +52,6 @@ const (
type limitedResponseWriter struct {
header http.Header
wroteHeader bool
status int
limit int
totalWritten int64
@@ -65,7 +64,6 @@ func newLimitedResponseWriter(limit int) *limitedResponseWriter {
}
return &limitedResponseWriter{
header: make(http.Header),
status: http.StatusOK,
limit: limit,
}
}
@@ -79,7 +77,6 @@ func (w *limitedResponseWriter) WriteHeader(statusCode int) {
return
}
w.wroteHeader = true
w.status = statusCode
}
func (w *limitedResponseWriter) Write(p []byte) (int, error) {