Browse Source

Merge pull request #13654 from id/20240820-fix-cluster-link-msg-forward

fix(cluster_link): always update msg fwd resource on config change
Ivan Dyachkov 1 year ago
parent
commit
69d268e5f3
1 changed files with 5 additions and 4 deletions
  1. 5 4
      apps/emqx_cluster_link/src/emqx_cluster_link_config.erl

+ 5 - 4
apps/emqx_cluster_link/src/emqx_cluster_link_config.erl

@@ -301,14 +301,15 @@ do_update_link({OldLinkConf, #{enable := true, name := Name} = NewLinkConf}) ->
         both ->
             _ = ensure_actor_stopped(Name),
             {ok, _Pid} = emqx_cluster_link_sup:ensure_actor(NewLinkConf),
-            ok = update_msg_fwd_resource(OldLinkConf, NewLinkConf);
+            ok;
         actor ->
             _ = ensure_actor_stopped(Name),
             {ok, _Pid} = emqx_cluster_link_sup:ensure_actor(NewLinkConf),
             ok;
-        msg_resource ->
-            ok = update_msg_fwd_resource(OldLinkConf, NewLinkConf)
-    end;
+        _ ->
+            ok
+    end,
+    ok = update_msg_fwd_resource(OldLinkConf, NewLinkConf);
 do_update_link({_OldLinkConf, #{enable := false, name := Name} = _NewLinkConf}) ->
     _ = emqx_cluster_link_mqtt:remove_msg_fwd_resource(Name),
     ensure_actor_stopped(Name).