refactor(clusterlink): use `emqx_bridge_mqtt_lib:clientid_base/1` to construct routesync client id
This commit is contained in:
parent
e7305c62ee
commit
e26e7acaa1
|
@ -51,6 +51,9 @@
|
||||||
|
|
||||||
-define(RECONNECT_TIMEOUT, 5_000).
|
-define(RECONNECT_TIMEOUT, 5_000).
|
||||||
|
|
||||||
|
-define(CLIENT_SUFFIX, ":routesync").
|
||||||
|
-define(PS_CLIENT_SUFFIX, ":routesync-ps").
|
||||||
|
|
||||||
%% Special actor for persistent routes that has the same actor name on all nodes.
|
%% Special actor for persistent routes that has the same actor name on all nodes.
|
||||||
%% Node actors with the same name nay race with each other (e.g. during bootstrap),
|
%% Node actors with the same name nay race with each other (e.g. during bootstrap),
|
||||||
%% but it must be tolerable, since persistent route destination is a client ID,
|
%% but it must be tolerable, since persistent route destination is a client ID,
|
||||||
|
@ -132,12 +135,12 @@ start_link_client(TargetCluster, Actor) ->
|
||||||
refine_client_options(Options = #{clientid := ClientID}, Actor) ->
|
refine_client_options(Options = #{clientid := ClientID}, Actor) ->
|
||||||
Suffix =
|
Suffix =
|
||||||
case Actor of
|
case Actor of
|
||||||
?PS_ACTOR -> "-ps";
|
?PS_ACTOR -> ?PS_CLIENT_SUFFIX;
|
||||||
_ -> ""
|
_ -> ?CLIENT_SUFFIX
|
||||||
end,
|
end,
|
||||||
%% TODO: Reconnect should help, but it looks broken right now.
|
%% TODO: Reconnect should help, but it looks broken right now.
|
||||||
Options#{
|
Options#{
|
||||||
clientid => emqx_utils:format("~s:~s:routesync~s", [ClientID, node(), Suffix]),
|
clientid => emqx_bridge_mqtt_lib:clientid_base([ClientID, Suffix]),
|
||||||
clean_start => false,
|
clean_start => false,
|
||||||
properties => #{'Session-Expiry-Interval' => 60},
|
properties => #{'Session-Expiry-Interval' => 60},
|
||||||
retry_interval => 0
|
retry_interval => 0
|
||||||
|
|
Loading…
Reference in New Issue