enhance database logging
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-01-16 14:28:26 +11:00
parent 588a552e4c
commit ab01c0fc4d
14 changed files with 1406 additions and 68 deletions

View File

@@ -20,7 +20,9 @@ import (
// @Router /vcenters [get]
func (h *Handler) VcenterList(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
_ = db.SyncVcenterTotalsFromSnapshots(ctx, h.Database.DB())
if err := db.SyncVcenterTotalsFromSnapshots(ctx, h.Database.DB()); err != nil {
h.Logger.Warn("failed to sync vcenter totals", "error", err)
}
vcs, err := db.ListVcenters(ctx, h.Database.DB())
if err != nil {
http.Error(w, fmt.Sprintf("failed to list vcenters: %v", err), http.StatusInternalServerError)
@@ -67,7 +69,9 @@ func (h *Handler) VcenterTotals(w http.ResponseWriter, r *http.Request) {
viewType = "hourly"
}
if viewType == "hourly" {
_ = db.SyncVcenterTotalsFromSnapshots(ctx, h.Database.DB())
if err := db.SyncVcenterTotalsFromSnapshots(ctx, h.Database.DB()); err != nil {
h.Logger.Warn("failed to sync vcenter totals", "error", err)
}
}
limit := 200
if l := r.URL.Query().Get("limit"); l != "" {