From 3911e0738b5bf39849e5a5c1f28015a62bc69e64 Mon Sep 17 00:00:00 2001 From: fanyh <8852086@qq.com> Date: Mon, 20 Jun 2022 20:06:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9clusterd=20node=20closed=20?= =?UTF-8?q?=E5=90=8E=E5=86=8D=E6=AC=A1=E5=91=BD=E4=B8=AD=5F=5Findex=20?= =?UTF-8?q?=E4=BC=9A=E7=BB=A7=E7=BB=AD=E8=A7=A6=E5=8F=91=20call=20changeno?= =?UTF-8?q?de=20(#1614)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/clusterd.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/service/clusterd.lua b/service/clusterd.lua index d13eded5..d9f61cd4 100644 --- a/service/clusterd.lua +++ b/service/clusterd.lua @@ -5,6 +5,7 @@ local cluster = require "skynet.cluster.core" local config_name = skynet.getenv "cluster" local node_address = {} local node_sender = {} +local node_sender_closed = {} local command = {} local config = {} local nodename = cluster.nodename() @@ -56,17 +57,21 @@ local function open_channel(t, key) if succ then t[key] = c ct.channel = c + node_sender_closed[key] = nil else err = string.format("changenode [%s] (%s:%s) failed", key, host, port) end elseif address == false then c = node_sender[key] - if c == nil then - -- no sender, always succ + if c == nil or node_sender_closed[key] then + -- no sender or closed, always succ succ = true else -- trun off the sender succ, err = pcall(skynet.call, c, "lua", "changenode", false) + if succ then --trun off failed, wait next index todo turn off + node_sender_closed[key] = true + end end else err = string.format("cluster node [%s] is absent.", key)