fix: 修复语法问题

This commit is contained in:
tbphp
2025-06-09 22:27:30 +08:00
parent 9562f0f6dd
commit 6b33f7054d
11 changed files with 124 additions and 39 deletions

View File

@@ -39,12 +39,20 @@ func (h *Handler) Health(c *gin.Context) {
httpStatus = http.StatusServiceUnavailable
}
// Calculate uptime (this should be tracked from server start time)
uptime := "unknown"
if startTime, exists := c.Get("serverStartTime"); exists {
if st, ok := startTime.(time.Time); ok {
uptime = time.Since(st).String()
}
}
c.JSON(httpStatus, gin.H{
"status": status,
"timestamp": time.Now().UTC().Format(time.RFC3339),
"healthy_keys": stats.HealthyKeys,
"total_keys": stats.TotalKeys,
"uptime": time.Since(time.Now()).String(), // This would need to be tracked properly
"uptime": uptime,
})
}