File tree Expand file tree Collapse file tree 1 file changed +4
-17
lines changed
Expand file tree Collapse file tree 1 file changed +4
-17
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ package main
55
66import (
77 "context"
8- "encoding/json"
98 "net/http"
109 "os"
1110 "path"
@@ -322,25 +321,13 @@ func runReceive(
322321 httpserver .WithGracePeriod (time .Duration (* conf .httpGracePeriod )),
323322 httpserver .WithTLSConfig (* conf .httpTLSConfig ),
324323 )
325- var lastDownscalePrepareTimestamp int64 = 0
326324 srv .Handle ("/-/downscale" , http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
327325 n := dbs .GetTenantsLen ()
328326 w .Header ().Set ("Tenant-Count" , strconv .Itoa (n ))
329- w .WriteHeader (http .StatusOK )
330- if r .Method == http .MethodDelete {
331- return
332- }
333- w .Header ().Set ("Content-Type" , "application/json" )
334- if lastDownscalePrepareTimestamp == 0 || n > 0 {
335- lastDownscalePrepareTimestamp = time .Now ().Unix ()
336- }
337- err := json .NewEncoder (w ).Encode (struct {
338- Timestamp int64 `json:"timestamp"`
339- }{
340- Timestamp : lastDownscalePrepareTimestamp ,
341- })
342- if err != nil {
343- level .Error (logger ).Log ("msg" , "error writing downscale response" , "err" , err )
327+ if n > 0 {
328+ w .WriteHeader (http .StatusTooEarly )
329+ } else {
330+ w .WriteHeader (http .StatusOK )
344331 }
345332 }))
346333 g .Add (func () error {
You can’t perform that action at this time.
0 commit comments