feat: 使用go-cache替代安全映射

ci: main自动发布附件
This commit is contained in:
Akizon77 committed 2025-06-24 14:36:30 +08:00
1 parent 8da28d6b95
commit 215fdc822c
6 files changed
+147 -48

No files matched your search

+3 -2
View File
@@ -19,6 +19,7 @@ import (
"github.com/komari-monitor/komari/database/tasks"
"github.com/komari-monitor/komari/utils/notification"
"github.com/komari-monitor/komari/ws"
"github.com/patrickmn/go-cache"
)
func UploadReport(c *gin.Context) {
@@ -185,8 +186,8 @@ func SaveClientReport(uuid string, report common.Report) error {
if report.CPU.Usage < 0.01 {
report.CPU.Usage = 0.01
}
reports = append(reports, report)
api.Records.Set(uuid, reports)
reports = append(reports.([]common.Report), report)
api.Records.Set(uuid, reports, cache.DefaultExpiration)
return nil
}