fix(bridge): ensure all bridge resources are stopped before app stop
This commit is contained in:
parent
d53106145f
commit
c47be57c59
|
@ -31,6 +31,7 @@
|
|||
|
||||
-export([
|
||||
load/0,
|
||||
unload/0,
|
||||
lookup/1,
|
||||
lookup/2,
|
||||
lookup/3,
|
||||
|
@ -75,6 +76,21 @@ load() ->
|
|||
maps:to_list(Bridges)
|
||||
).
|
||||
|
||||
unload() ->
|
||||
unload_hook(),
|
||||
Bridges = emqx:get_config([bridges], #{}),
|
||||
lists:foreach(
|
||||
fun({Type, NamedConf}) ->
|
||||
lists:foreach(
|
||||
fun({Name, _Conf}) ->
|
||||
_ = emqx_bridge_resource:stop(Type, Name)
|
||||
end,
|
||||
maps:to_list(NamedConf)
|
||||
)
|
||||
end,
|
||||
maps:to_list(Bridges)
|
||||
).
|
||||
|
||||
safe_load_bridge(Type, Name, Conf, Opts) ->
|
||||
try
|
||||
_Res = emqx_bridge_resource:create(Type, Name, Conf, Opts),
|
||||
|
|
|
@ -39,7 +39,7 @@ start(_StartType, _StartArgs) ->
|
|||
stop(_State) ->
|
||||
emqx_conf:remove_handler(?LEAF_NODE_HDLR_PATH),
|
||||
emqx_conf:remove_handler(?TOP_LELVE_HDLR_PATH),
|
||||
ok = emqx_bridge:unload_hook(),
|
||||
ok = emqx_bridge:unload(),
|
||||
ok.
|
||||
|
||||
-if(?EMQX_RELEASE_EDITION == ee).
|
||||
|
|
Loading…
Reference in New Issue