Skip to content

Commit 8da5b4a

Browse files
committed
add error handling
1 parent 2dac034 commit 8da5b4a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

cmd/thanos/receive.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,14 @@ func runReceive(
334334
if lastDownscalePrepareTimestamp == 0 || n > 0 {
335335
lastDownscalePrepareTimestamp = time.Now().Unix()
336336
}
337-
json.NewEncoder(w).Encode(struct {
337+
err := json.NewEncoder(w).Encode(struct {
338338
Timestamp int64 `json:"timestamp"`
339-
}{Timestamp: lastDownscalePrepareTimestamp})
339+
}{
340+
Timestamp: lastDownscalePrepareTimestamp,
341+
})
342+
if err != nil {
343+
level.Error(logger).Log("msg", "error writing downscale response", "err", err)
344+
}
340345
}))
341346
g.Add(func() error {
342347
statusProber.Healthy()

0 commit comments

Comments
 (0)