fix(telemetry): Fix dialyzer warning about mnesia dirty op race

This commit is contained in:
Zaiming Shi 2020-11-03 21:34:06 +01:00
parent 996b205299
commit bcae92ae6d
1 changed files with 7 additions and 1 deletions

View File

@ -132,6 +132,12 @@ get_telemetry() ->
%% gen_server callbacks %% gen_server callbacks
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% This is to suppress dialyzer warnings for mnesia:dirty_write and
%% dirty_read race condition. Given that the init function is not evaluated
%% concurrently in one node, it should be free of race condition.
%% Given the chance of having two nodes bootstraping with the write
%% is very small, it should be safe to ignore.
-dialyzer([{nowarn_function, [init/1]}]).
init([Opts]) -> init([Opts]) ->
State = #state{url = get_value(url, Opts), State = #state{url = get_value(url, Opts),
report_interval = timer:seconds(get_value(report_interval, Opts))}, report_interval = timer:seconds(get_value(report_interval, Opts))},
@ -409,4 +415,4 @@ module_attributes(Module) ->
bin(L) when is_list(L) -> bin(L) when is_list(L) ->
list_to_binary(L); list_to_binary(L);
bin(B) when is_binary(B) -> bin(B) when is_binary(B) ->
B. B.