mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-11-10 14:44:04 +08:00
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:
1 parent
70781daf2d
commit
7a8c9cf83c
3 files changed
+4
-4
No files matched your search
+2
-3
@@ -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(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user