fix: cluster crash
This commit is contained in:
parent
1345b7e993
commit
26a57a00bb
|
@ -337,12 +337,18 @@ all() ->
|
|||
%% @doc Get metric value
|
||||
-spec val(metric_name()) -> non_neg_integer().
|
||||
val(Name) ->
|
||||
try
|
||||
case ets:lookup(?TAB, Name) of
|
||||
[#metric{idx = Idx}] ->
|
||||
CRef = persistent_term:get(?MODULE),
|
||||
counters:get(CRef, Idx);
|
||||
[] ->
|
||||
0
|
||||
end
|
||||
%% application will restart when join cluster, then ets not exist.
|
||||
catch
|
||||
error:badarg ->
|
||||
0
|
||||
end.
|
||||
|
||||
%% @doc Increase counter
|
||||
|
|
|
@ -13,6 +13,7 @@ node {
|
|||
cookie: emqxsecretcookie
|
||||
data_dir: "{{ platform_data_dir }}"
|
||||
etc_dir: "{{ platform_etc_dir }}"
|
||||
applications: "{{ emqx_machine_boot_apps }}"
|
||||
}
|
||||
|
||||
log {
|
||||
|
|
Loading…
Reference in New Issue