fix(sessds): Prevent hot update of session_persistence.enable config

This commit is contained in:
ieQu1 2024-03-07 12:19:53 +01:00
parent 98034cb4dd
commit c62776edaf
2 changed files with 19 additions and 0 deletions

View File

@ -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() ->

View File

@ -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) ->