Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yuchen-db committed Oct 12, 2024
1 parent 955332b commit f7e1173
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/server/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down

0 comments on commit f7e1173

Please sign in to comment.