From d80a3022e60eecca480a677fe3194525da1f7104 Mon Sep 17 00:00:00 2001 From: caffeinated92 Date: Sat, 14 Sep 2024 20:19:11 +0700 Subject: [PATCH] make into one function --- cluster/srv_del.go | 1 + cluster/srv_set.go | 1 + server/api_database.go | 2 -- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cluster/srv_del.go b/cluster/srv_del.go index 9c4fff423..2ac496cc5 100644 --- a/cluster/srv_del.go +++ b/cluster/srv_del.go @@ -121,4 +121,5 @@ func (server *ServerMonitor) DelBackupTypeCookie(backtype string) error { func (server *ServerMonitor) DelMaintenance() { server.IsMaintenance = false + server.ClusterGroup.SetProxyServerMaintenance(server.ServerID) } diff --git a/cluster/srv_set.go b/cluster/srv_set.go index 13710451a..933eac52c 100644 --- a/cluster/srv_set.go +++ b/cluster/srv_set.go @@ -188,6 +188,7 @@ func (server *ServerMonitor) SetReadWrite() error { func (server *ServerMonitor) SetMaintenance() { server.IsMaintenance = true + server.ClusterGroup.SetProxyServerMaintenance(server.ServerID) } func (server *ServerMonitor) SetDSN() { diff --git a/server/api_database.go b/server/api_database.go index 10a5c78ea..6d1c4d601 100644 --- a/server/api_database.go +++ b/server/api_database.go @@ -765,7 +765,6 @@ func (repman *ReplicationManager) handlerMuxServerSetMaintenance(w http.Response node := mycluster.GetServerFromName(vars["serverName"]) if node != nil { node.SetMaintenance() - mycluster.SetProxyServerMaintenance(node.ServerID) } else { http.Error(w, "Server Not Found", 500) return @@ -788,7 +787,6 @@ func (repman *ReplicationManager) handlerMuxServerDelMaintenance(w http.Response node := mycluster.GetServerFromName(vars["serverName"]) if node != nil { node.DelMaintenance() - mycluster.SetProxyServerMaintenance(node.ServerID) } else { http.Error(w, "Server Not Found", 500) return