fix
This commit is contained in:
parent
486d870b42
commit
9ecebfde0c
@ -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),
|
||||
|
||||
|
||||
@ -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() ->
|
||||
@ -80,4 +80,10 @@ queue_limited_in(Item, Q, Num) when is_integer(Num) ->
|
||||
queue:in(Item, Q1);
|
||||
false ->
|
||||
queue:in(Item, Q)
|
||||
end.
|
||||
end.
|
||||
|
||||
-spec assert_exec(boolean(), any()) -> any().
|
||||
assert_exec(true, Fun) when is_function(Fun, 0) ->
|
||||
{ok, Fun()};
|
||||
assert_exec(_, _) ->
|
||||
aborted.
|
||||
Loading…
x
Reference in New Issue
Block a user