This commit is contained in:
安礼成 2023-03-03 14:24:56 +08:00
parent 486d870b42
commit 9ecebfde0c
2 changed files with 11 additions and 2 deletions

View File

@ -13,6 +13,9 @@ start(_StartType, _StartArgs) ->
io:setopts([{encoding, unicode}]),
%%
mnesia:start(),
Tables = mnesia:system_info(tables),
iot_util:assert_exec(lists:member(router, [Tables]), fun() -> mnesia:wait_for_tables([router], infinity) end),
%%
erlang:system_flag(fullsweep_after, 16),

View File

@ -13,7 +13,7 @@
-export([timestamp/0, number_format/2, current_time/0]).
-export([step/3, chunks/2, rand_bytes/1, uuid/0]).
-export([json_data/1, json_error/2]).
-export([queue_limited_in/3]).
-export([queue_limited_in/3, assert_exec/2]).
%%
timestamp() ->
@ -81,3 +81,9 @@ queue_limited_in(Item, Q, Num) when is_integer(Num) ->
false ->
queue:in(Item, Q)
end.
-spec assert_exec(boolean(), any()) -> any().
assert_exec(true, Fun) when is_function(Fun, 0) ->
{ok, Fun()};
assert_exec(_, _) ->
aborted.