From f7e11734fe507fd65977e4bba790518b815e9a22 Mon Sep 17 00:00:00 2001 From: Yuchen Wang Date: Fri, 11 Oct 2024 22:59:54 -0700 Subject: [PATCH] update --- pkg/server/http/http.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/server/http/http.go b/pkg/server/http/http.go index e36c078b81..d6723ae535 100644 --- a/pkg/server/http/http.go +++ b/pkg/server/http/http.go @@ -77,12 +77,13 @@ func RegisterDownscale[K comparable, V any](s *Server, m map[K]V, t *int64) { if r.Method == http.MethodDelete { return } + if t == nil { + now := time.Now().Unix() + t = &now + } w.Header().Set("Content-Type", "application/json") if len(m) == 0 { level.Info(s.logger).Log("msg", "no tenants, good to downscale") - if t == nil { - *t = time.Now().Unix() - } json.NewEncoder(w).Encode(struct { Timestamp int64 `json:"timestamp"` }{Timestamp: *t})