Merge pull request #8345 from HJianBo/refresh-http-handlers

chore: stop http listener to load latest http handlers
This commit is contained in:
JianBo He 2022-06-29 21:26:21 +08:00 committed by GitHub
commit 905ae0dcad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 1 deletions

View File

@ -1,7 +1,10 @@
%% -*- mode: erlang -*-
{VSN,
[ {<<"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']}},
{restart_application, emqx_management}
]},

View File

@ -85,6 +85,8 @@ listeners() ->
application:get_env(?APP, listeners, []).
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").
http_handlers() ->

View File

@ -5,12 +5,19 @@
%% NOTE: this depends on the fact that emqx_dashboard is always
%% the last application gets upgraded
[ {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}
, {apply, {emqx_plugins, load, []}}
]}
],
[ {<<".*">>,
[ {apply, {emqx_rule_engine, load_providers, []}}
, {apply, {minirest, stop_http, ['http:dashboard']}}
, {apply, {minirest, stop_http, ['https:dashboard']}}
, {restart_application, emqx_dashboard}
, {apply, {emqx_plugins, load, []}}
]}

View File

@ -80,6 +80,8 @@ listeners() ->
application:get_env(?APP, listeners, []).
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").
%%--------------------------------------------------------------------