fix(message validation): don't call `emqx_conf:update` during boot
`load/0` and `unload/0` shouldn't call cluster operations.
This commit is contained in:
parent
4403b4f5ce
commit
d3bc32dc35
|
@ -69,10 +69,22 @@ remove_handler() ->
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
load() ->
|
load() ->
|
||||||
lists:foreach(fun insert/1, emqx:get_config(?VALIDATIONS_CONF_PATH, [])).
|
Validations = emqx:get_config(?VALIDATIONS_CONF_PATH, []),
|
||||||
|
lists:foreach(
|
||||||
|
fun({Pos, Validation}) ->
|
||||||
|
ok = emqx_message_validation_registry:insert(Pos, Validation)
|
||||||
|
end,
|
||||||
|
lists:enumerate(Validations)
|
||||||
|
).
|
||||||
|
|
||||||
unload() ->
|
unload() ->
|
||||||
lists:foreach(fun delete/1, emqx:get_config(?VALIDATIONS_CONF_PATH, [])).
|
Validations = emqx:get_config(?VALIDATIONS_CONF_PATH, []),
|
||||||
|
lists:foreach(
|
||||||
|
fun(Validation) ->
|
||||||
|
ok = emqx_message_validation_registry:delete(Validation)
|
||||||
|
end,
|
||||||
|
Validations
|
||||||
|
).
|
||||||
|
|
||||||
-spec list() -> [validation()].
|
-spec list() -> [validation()].
|
||||||
list() ->
|
list() ->
|
||||||
|
|
Loading…
Reference in New Issue