Merge pull request #12665 from ieQu1/dev/sessds-hot-conf-disable
fix(sessds): Prevent hot update of session_persistence.enable config
This commit is contained in:
commit
69a9431471
|
@ -715,6 +715,7 @@ add_handlers() ->
|
|||
ok = emqx_config_logger:add_handler(),
|
||||
ok = emqx_config_zones:add_handler(),
|
||||
emqx_sys_mon:add_handler(),
|
||||
emqx_persistent_message:add_handler(),
|
||||
ok.
|
||||
|
||||
remove_handlers() ->
|
||||
|
|
|
@ -16,11 +16,16 @@
|
|||
|
||||
-module(emqx_persistent_message).
|
||||
|
||||
-behaviour(emqx_config_handler).
|
||||
|
||||
-include("emqx.hrl").
|
||||
|
||||
-export([init/0]).
|
||||
-export([is_persistence_enabled/0, force_ds/0]).
|
||||
|
||||
%% Config handler
|
||||
-export([add_handler/0, pre_config_update/3]).
|
||||
|
||||
%% Message persistence
|
||||
-export([
|
||||
persist/1
|
||||
|
@ -66,6 +71,19 @@ storage_backend(Path) ->
|
|||
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
-spec add_handler() -> ok.
|
||||
add_handler() ->
|
||||
emqx_conf:add_handler([session_persistence], ?MODULE).
|
||||
|
||||
pre_config_update([session_persistence], #{<<"enable">> := New}, #{<<"enable">> := Old}) when
|
||||
New =/= Old
|
||||
->
|
||||
{error, "Hot update of session_persistence.enable parameter is currently not supported"};
|
||||
pre_config_update(_Root, _NewConf, _OldConf) ->
|
||||
ok.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
-spec persist(emqx_types:message()) ->
|
||||
ok | {skipped, _Reason} | {error, _TODO}.
|
||||
persist(Msg) ->
|
||||
|
|
Loading…
Reference in New Issue