From 2c076ebd9678be45412f96a1513153ff23a49dff Mon Sep 17 00:00:00 2001 From: Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> Date: Tue, 11 Jul 2023 11:38:52 +0500 Subject: [PATCH] avoid logging nil error (#4659) Co-authored-by: Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.co> --- weed/server/raft_server_handlers.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/weed/server/raft_server_handlers.go b/weed/server/raft_server_handlers.go index 8f4a347d7..eba61569e 100644 --- a/weed/server/raft_server_handlers.go +++ b/weed/server/raft_server_handlers.go @@ -41,7 +41,9 @@ func (s *RaftServer) HealthzHandler(w http.ResponseWriter, r *http.Request) { expBackoff.MaxInterval = 1 * time.Second expBackoff.MaxElapsedTime = 5 * time.Second isLocked, err := backoff.RetryWithData(s.topo.IsChildLocked, expBackoff) - glog.Errorf("HealthzHandler: %+v", err) + if err != nil { + glog.Errorf("HealthzHandler: %+v", err) + } if isLocked { w.WriteHeader(http.StatusLocked) return