Merge pull request #8345 from HJianBo/refresh-http-handlers
chore: stop http listener to load latest http handlers
This commit is contained in:
commit
905ae0dcad
|
@ -1,7 +1,10 @@
|
||||||
%% -*- mode: erlang -*-
|
%% -*- mode: erlang -*-
|
||||||
{VSN,
|
{VSN,
|
||||||
[ {<<"4\\.3\\.[0-9]+">>,
|
[ {<<"4\\.3\\.[0-9]+">>,
|
||||||
[ {apply,{minirest,stop_http,['http:management']}},
|
[ %% Stop the http listener to load the latest http handlers.
|
||||||
|
%% We can only stop these listeners here because we can't get the list of
|
||||||
|
%% currently started http listener via app-env during the hot upgrade.
|
||||||
|
{apply,{minirest,stop_http,['http:management']}},
|
||||||
{apply,{minirest,stop_http,['https:management']}},
|
{apply,{minirest,stop_http,['https:management']}},
|
||||||
{restart_application, emqx_management}
|
{restart_application, emqx_management}
|
||||||
]},
|
]},
|
||||||
|
|
|
@ -85,6 +85,8 @@ listeners() ->
|
||||||
application:get_env(?APP, listeners, []).
|
application:get_env(?APP, listeners, []).
|
||||||
|
|
||||||
listener_name(Proto) ->
|
listener_name(Proto) ->
|
||||||
|
%% NOTE: this name has referenced by emqx_management.appup.src.
|
||||||
|
%% Please don't change it except you have got how to handle it in hot-upgrade
|
||||||
list_to_atom(atom_to_list(Proto) ++ ":management").
|
list_to_atom(atom_to_list(Proto) ++ ":management").
|
||||||
|
|
||||||
http_handlers() ->
|
http_handlers() ->
|
||||||
|
|
|
@ -5,12 +5,19 @@
|
||||||
%% NOTE: this depends on the fact that emqx_dashboard is always
|
%% NOTE: this depends on the fact that emqx_dashboard is always
|
||||||
%% the last application gets upgraded
|
%% the last application gets upgraded
|
||||||
[ {apply, {emqx_rule_engine, load_providers, []}}
|
[ {apply, {emqx_rule_engine, load_providers, []}}
|
||||||
|
%% Stop the http listener to load the latest http handlers.
|
||||||
|
%% We can only stop these listeners here because we can't get the list of
|
||||||
|
%% currently started http listener via app-env during the hot upgrade.
|
||||||
|
, {apply, {minirest, stop_http, ['http:dashboard']}}
|
||||||
|
, {apply, {minirest, stop_http, ['https:dashboard']}}
|
||||||
, {restart_application, emqx_dashboard}
|
, {restart_application, emqx_dashboard}
|
||||||
, {apply, {emqx_plugins, load, []}}
|
, {apply, {emqx_plugins, load, []}}
|
||||||
]}
|
]}
|
||||||
],
|
],
|
||||||
[ {<<".*">>,
|
[ {<<".*">>,
|
||||||
[ {apply, {emqx_rule_engine, load_providers, []}}
|
[ {apply, {emqx_rule_engine, load_providers, []}}
|
||||||
|
, {apply, {minirest, stop_http, ['http:dashboard']}}
|
||||||
|
, {apply, {minirest, stop_http, ['https:dashboard']}}
|
||||||
, {restart_application, emqx_dashboard}
|
, {restart_application, emqx_dashboard}
|
||||||
, {apply, {emqx_plugins, load, []}}
|
, {apply, {emqx_plugins, load, []}}
|
||||||
]}
|
]}
|
||||||
|
|
|
@ -80,6 +80,8 @@ listeners() ->
|
||||||
application:get_env(?APP, listeners, []).
|
application:get_env(?APP, listeners, []).
|
||||||
|
|
||||||
listener_name(Proto) ->
|
listener_name(Proto) ->
|
||||||
|
%% NOTE: this name has referenced by emqx_dashboard.appup.src.
|
||||||
|
%% Please don't change it except you have got how to handle it in hot-upgrade
|
||||||
list_to_atom(atom_to_list(Proto) ++ ":dashboard").
|
list_to_atom(atom_to_list(Proto) ++ ":dashboard").
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue