From ea860f1ca6d96c723004dfb343bea399da720d54 Mon Sep 17 00:00:00 2001 From: DDDHuang <44492639+DDDHuang@users.noreply.github.com> Date: Mon, 21 Feb 2022 10:42:33 +0800 Subject: [PATCH] fix: emqx_cluster_rpc start link --- apps/emqx_conf/src/emqx_cluster_rpc.erl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/emqx_conf/src/emqx_cluster_rpc.erl b/apps/emqx_conf/src/emqx_cluster_rpc.erl index 2c8b14393..1947d400d 100644 --- a/apps/emqx_conf/src/emqx_cluster_rpc.erl +++ b/apps/emqx_conf/src/emqx_cluster_rpc.erl @@ -75,7 +75,14 @@ start_link() -> start_link(node(), ?MODULE, get_retry_ms()). start_link(Node, Name, RetryMs) -> - gen_server:start_link({local, Name}, ?MODULE, [Node, RetryMs], []). + case gen_server:start_link({local, Name}, ?MODULE, [Node, RetryMs], []) of + {ok, Pid} -> + {ok, Pid}; + {error, {already_started, Pid}} -> + {ok, Pid}; + {error, Reason} -> + {error, Reason} + end. %% @doc return {ok, TnxId, MFARes} the first MFA result when all MFA run ok. %% return {error, MFARes} when the first MFA result is no ok or {ok, term()}.