A draining node is not ready: let Ready say so, not handleReady

meshCluster.Ready is already false while draining, since the node acts as passive; the extra check in handleReady was redundant. The fake cluster now follows the same contract.
This commit is contained in:
binwiederhier committed 2026-10-24 18:35:10 +00:00
1 parent 70781daf2d
commit 7a8c9cf83c
3 files changed
+4 -4

No files matched your search

+2 -3
View File
@@ -851,15 +851,14 @@ func (s *Server) handleHealth(w http.ResponseWriter, _ *http.Request, _ *visitor
// handleReady answers whether a load balancer should send clients here (see cluster.Cluster's
// Ready). A passive node is healthy (see handleHealth) but never ready.
func (s *Server) handleReady(w http.ResponseWriter, _ *http.Request, _ *visitor) error {
draining := s.cluster.Draining()
ready := s.cluster.Ready() && !draining
ready := s.cluster.Ready()
if !ready {
w.WriteHeader(http.StatusServiceUnavailable)
}
return s.writeJSON(w, &apiReadyResponse{
Ready: ready,
Role: s.cluster.Role(),
Draining: draining,
Draining: s.cluster.Draining(),
})
}