fix: only cache sys_memory in linux

This commit is contained in:
Zhongwen Deng 2023-02-01 12:21:34 +08:00
parent 71f00f2962
commit 56b9238645
2 changed files with 9 additions and 3 deletions

View File

@ -150,7 +150,7 @@ node_info() ->
get_sys_memory() ->
case os:type() of
{unix, linux} ->
emqx_mgmt_sys_memory:get_sys_memory();
emqx_mgmt_cache:get_sys_memory();
_ ->
{0, 0}
end.

View File

@ -26,8 +26,14 @@ start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
init([]) ->
LC = child_spec(emqx_mgmt_cache, 5000, worker),
{ok, {{one_for_one, 1, 5}, [LC]}}.
Workers =
case os:type() of
{unix, linux} ->
[child_spec(emqx_mgmt_cache, 5000, worker)];
_ ->
[]
end,
{ok, {{one_for_one, 1, 5}, Workers}}.
child_spec(Mod, Shutdown, Type) ->
#{