fix(rule): fix edit rule fail in the cluster

This commit is contained in:
Turtle 2021-09-14 13:53:41 +08:00 committed by turtleDeng
parent 4664b85968
commit 3ad0678892
3 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{application, emqx_rule_engine,
[{description, "EMQ X Rule Engine"},
{vsn, "4.3.4"}, % strict semver, bump manually!
{vsn, "4.3.5"}, % strict semver, bump manually!
{modules, []},
{registered, [emqx_rule_engine_sup, emqx_rule_registry]},
{applications, [kernel,stdlib,rulesql,getopt]},

View File

@ -1,5 +1,5 @@
%% -*-: erlang -*-
{"4.3.4",
{"4.3.5",
[ {"4.3.0",
[ {load_module, emqx_rule_funcs, brutal_purge, soft_purge, []}
, {load_module, emqx_rule_engine, brutal_purge, soft_purge, []}
@ -23,6 +23,9 @@
[ {load_module, emqx_rule_engine, brutal_purge, soft_purge, []}
, {load_module, emqx_rule_actions, brutal_purge, soft_purge, []}
]},
{"4.3.4",
[ {load_module, emqx_rule_engine, brutal_purge, soft_purge, []}
]},
{<<".*">>, []}
],
[
@ -49,6 +52,9 @@
[ {load_module, emqx_rule_engine, brutal_purge, soft_purge, []}
, {load_module, emqx_rule_actions, brutal_purge, soft_purge, []}
]},
{"4.3.4",
[ {load_module, emqx_rule_engine, brutal_purge, soft_purge, []}
]},
{<<".*">>, []}
]
}.

View File

@ -475,10 +475,10 @@ may_update_rule_params(Rule = #rule{enabled = OldEnb, actions = Actions, state =
Params = #{enabled := NewEnb}) ->
State = case {OldEnb, NewEnb} of
{false, true} ->
refresh_rule(Rule),
_ = ?CLUSTER_CALL(refresh_rule, [Rule]),
force_changed;
{true, false} ->
clear_actions(Actions),
_ = ?CLUSTER_CALL(clear_actions, [Actions]),
force_changed;
_NoChange -> OldState
end,
@ -637,7 +637,7 @@ refresh_actions(Actions, Pred) ->
true ->
{ok, #action{module = Mod, on_create = Create}}
= emqx_rule_registry:find_action(ActName),
_ = ?CLUSTER_CALL(init_action, [Mod, Create, Id, with_resource_params(Args)]),
_ = init_action(Mod, Create, Id, with_resource_params(Args)),
refresh_actions(Fallbacks, Pred);
false -> ok
end