fix: don't crash if application is already loaded

```
Runtime terminating during boot ({{badmatch,{error,{already_loaded,wolff}}},[{emqx_conf,load,2,[{file,"emqx_conf.erl"},{line,167}]},{lists,foreach_1,2,[{file,"lists.erl"},{line,1686}]},{emqx_conf,dump_schema,2,[{file,"emqx_conf.erl"},{line,150}]},{erl_eval,do_apply,7,[{file,"erl_eval.erl"},{line,746}]},{erl_eval,expr,6,[{file,"erl_eval.erl"},{line,494}]},{erl_eval,exprs,6,[{file,"erl_eval.erl"},{line,136}]},{init,start_it,1,[]},{init,start_em,1,[]}]})
```
This commit is contained in:
Thales Macedo Garitezi 2024-06-26 09:57:47 -03:00
parent f7b1baf1ef
commit e81494a132
1 changed files with 7 additions and 2 deletions

View File

@ -163,8 +163,13 @@ dump_schema(Dir, SchemaModule) ->
),
emqx_dashboard:save_dispatch_eterm(SchemaModule).
load(emqx_enterprise_schema, emqx_telemetry) -> ignore;
load(_, Lib) -> ok = application:load(Lib).
load(emqx_enterprise_schema, emqx_telemetry) ->
ignore;
load(_, Lib) ->
case application:load(Lib) of
ok -> ok;
{error, {already_loaded, _}} -> ok
end.
%% for scripts/spellcheck.
gen_schema_json(Dir, SchemaModule, Lang) ->