From cda126f1b91e1bbdc7bae62201a09d077586af6c Mon Sep 17 00:00:00 2001 From: liuzhenghua <1090179900@qq.com> Date: Wed, 2 Apr 2025 13:11:11 +0000 Subject: [PATCH 1/2] Increase NODE_DISCONNECTED_TIMEOUT --- internal/cluster/cluster_lifetime.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/cluster/cluster_lifetime.go b/internal/cluster/cluster_lifetime.go index b4d1b92f92..f4e99c7405 100644 --- a/internal/cluster/cluster_lifetime.go +++ b/internal/cluster/cluster_lifetime.go @@ -27,7 +27,7 @@ const ( // each node will also update its own status to remain active. If a node becomes inactive, it will be removed from the cluster. NODE_VOTE_INTERVAL = time.Second * 30 // interval to vote the ips of the nodes UPDATE_NODE_STATUS_INTERVAL = time.Second * 5 // interval to update the status of the node - NODE_DISCONNECTED_TIMEOUT = time.Second * 10 // once a node is no longer active, it will be removed from the cluster + NODE_DISCONNECTED_TIMEOUT = time.Second * 60 // once a node is no longer active, it will be removed from the cluster // plugin scheduler // each node will schedule its plugins every $PLUGIN_SCHEDULER_INTERVAL time From 7084672fe54793be596ba34b84fa8bbffb539306 Mon Sep 17 00:00:00 2001 From: liuzhenghua <1090179900@qq.com> Date: Thu, 3 Apr 2025 12:21:06 +0000 Subject: [PATCH 2/2] Modify the implementation of vote --- internal/cluster/cluster_lifetime.go | 2 +- internal/cluster/vote.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/cluster/cluster_lifetime.go b/internal/cluster/cluster_lifetime.go index f4e99c7405..3f40c90371 100644 --- a/internal/cluster/cluster_lifetime.go +++ b/internal/cluster/cluster_lifetime.go @@ -27,7 +27,7 @@ const ( // each node will also update its own status to remain active. If a node becomes inactive, it will be removed from the cluster. NODE_VOTE_INTERVAL = time.Second * 30 // interval to vote the ips of the nodes UPDATE_NODE_STATUS_INTERVAL = time.Second * 5 // interval to update the status of the node - NODE_DISCONNECTED_TIMEOUT = time.Second * 60 // once a node is no longer active, it will be removed from the cluster + NODE_DISCONNECTED_TIMEOUT = time.Second * 25 // once a node is no longer active, it will be removed from the cluster // plugin scheduler // each node will schedule its plugins every $PLUGIN_SCHEDULER_INTERVAL time diff --git a/internal/cluster/vote.go b/internal/cluster/vote.go index 545a5449f5..301d383bc7 100644 --- a/internal/cluster/vote.go +++ b/internal/cluster/vote.go @@ -51,7 +51,7 @@ func (c *Cluster) voteAddresses() error { } } - ipsVoting[addr.fullAddress()] = c.voteAddress(addr) == nil + ipsVoting[addr.fullAddress()] = time.Since(time.Unix(nodeStatus.LastPingAt, 0)) < c.nodeDisconnectedTimeout } // lock the node status