From b1a69f70bd4c51b29db4a0d31b196257b5e83d66 Mon Sep 17 00:00:00 2001 From: Chris O'Haver Date: Thu, 1 Oct 2020 10:13:23 -0400 Subject: [PATCH] dont return 200 during shutdown (#4167) Signed-off-by: Chris O'Haver --- plugin/ready/ready.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugin/ready/ready.go b/plugin/ready/ready.go index a76a20084..2002e4a90 100644 --- a/plugin/ready/ready.go +++ b/plugin/ready/ready.go @@ -43,6 +43,13 @@ func (rd *ready) onStartup() error { rd.Unlock() rd.mux.HandleFunc("/ready", func(w http.ResponseWriter, _ *http.Request) { + rd.Lock() + defer rd.Unlock() + if !rd.done { + w.WriteHeader(http.StatusServiceUnavailable) + io.WriteString(w, "Shutting down") + return + } ok, todo := plugins.Ready() if ok { w.WriteHeader(http.StatusOK)