diff --git a/config.yaml b/config.yaml index 35c1815..3a18975 100644 --- a/config.yaml +++ b/config.yaml @@ -1,5 +1,5 @@ -version: 2.0.0 +version: 2.0.1 log: writers: file # 输出位置,有两个可选项 —— file 和 stdout。选择 file 会将日志记录到 logger_file 指定的日志文件中,选择 stdout 会将日志输出到标准输出,当然也可以两者同时选择 diff --git a/config_cluster.yaml b/config_cluster.yaml index 9f1fa6d..17984ed 100644 --- a/config_cluster.yaml +++ b/config_cluster.yaml @@ -1,5 +1,5 @@ -version: 2.0.0 +version: 2.0.1 log: writers: file # 输出位置,有两个可选项 —— file 和 stdout。选择 file 会将日志记录到 logger_file 指定的日志文件中,选择 stdout 会将日志输出到标准输出,当然也可以两者同时选择 diff --git a/rpcservice/heartbeat/client.go b/rpcservice/heartbeat/client.go index 5074796..c7a07cf 100644 --- a/rpcservice/heartbeat/client.go +++ b/rpcservice/heartbeat/client.go @@ -105,6 +105,8 @@ func (h *Client) StartHeartbeat() { log.Errorf(err, "heartbeat") // master失去联系 h.IsMasterAlive = false + // 将master节点对应的peers删除 + go deletePeersInNode(h.masterAddr) h.DialHeartbeatService() } log.Infof("heartbeatResp %s", heartbeatResp) @@ -132,6 +134,8 @@ func (h *Client) StartHeartbeat() { }() } + + func deletePeersInNode(addr string) { hub.GetInstance().Clients.Range(func(peerId, peer interface{}) bool { cli := peer.(*client.Client)