fix(emqx_psk): wait for Mria table on app start

This ensures emqx_psk table is synced to a replicant even if it doesn't have init psk file.
This commit is contained in:
Serge Tupchii 2023-06-27 16:31:53 +03:00
parent 30d78aaac2
commit 8e877caf47
7 changed files with 29 additions and 5 deletions

View File

@ -3,7 +3,7 @@
{id, "emqx_machine"},
{description, "The EMQX Machine"},
% strict semver, bump manually!
{vsn, "0.2.6"},
{vsn, "0.2.7"},
{modules, []},
{registered, []},
{applications, [kernel, stdlib, emqx_ctl]},

View File

@ -144,7 +144,8 @@ basic_reboot_apps() ->
emqx_authz,
emqx_slow_subs,
emqx_auto_subscribe,
emqx_plugins
emqx_plugins,
emqx_psk
] ++ basic_reboot_apps_edition(emqx_release:edition()).
basic_reboot_apps_edition(ce) ->

View File

@ -0,0 +1,19 @@
%%--------------------------------------------------------------------
%% Copyright (c) 2023 EMQ Technologies Co., Ltd. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
%%--------------------------------------------------------------------
-define(TAB, emqx_psk).
-define(PSK_SHARD, emqx_psk_shard).

View File

@ -2,7 +2,7 @@
{application, emqx_psk, [
{description, "EMQX PSK"},
% strict semver, bump manually!
{vsn, "5.0.2"},
{vsn, "5.0.3"},
{modules, []},
{registered, [emqx_psk_sup]},
{applications, [kernel, stdlib]},

View File

@ -66,8 +66,7 @@
-boot_mnesia({mnesia, [boot]}).
-define(TAB, ?MODULE).
-define(PSK_SHARD, emqx_psk_shard).
-include("emqx_psk.hrl").
-define(DEFAULT_DELIMITER, <<":">>).

View File

@ -23,7 +23,10 @@
stop/1
]).
-include("emqx_psk.hrl").
start(_Type, _Args) ->
ok = mria:wait_for_tables([?TAB]),
{ok, Sup} = emqx_psk_sup:start_link(),
{ok, Sup}.

View File

@ -0,0 +1,2 @@
Wait for Mria table when emqx_psk app is being started to ensure that
PSK data is synced to replicant nodes even if they don't have init PSK file.