fix: disable rule if build fail

This commit is contained in:
DDDHuang 2021-04-20 19:29:39 +08:00 committed by JianBo He
parent 19a9bab3a4
commit 4178e1a023
1 changed files with 1 additions and 0 deletions

View File

@ -396,6 +396,7 @@ refresh_rules() ->
lists:foreach(fun(#rule{id = RuleId} = Rule) -> lists:foreach(fun(#rule{id = RuleId} = Rule) ->
try refresh_rule(Rule) try refresh_rule(Rule)
catch Error:Reason:ST -> catch Error:Reason:ST ->
emqx_rule_registry:add_rule(Rule#rule{enabled = false}),
logger:critical( logger:critical(
"Can not re-build rule ~p: ~0p. The rule is disabled." "Can not re-build rule ~p: ~0p. The rule is disabled."
"Fix the issue and enable it manually.\n" "Fix the issue and enable it manually.\n"