From bcae92ae6de2ed0bc0fbc8cb3caede8b382ccb9a Mon Sep 17 00:00:00 2001 From: Zaiming Shi Date: Tue, 3 Nov 2020 21:34:06 +0100 Subject: [PATCH] fix(telemetry): Fix dialyzer warning about mnesia dirty op race --- apps/emqx_telemetry/src/emqx_telemetry.erl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/emqx_telemetry/src/emqx_telemetry.erl b/apps/emqx_telemetry/src/emqx_telemetry.erl index 0dbb2fc19..e98e08c90 100644 --- a/apps/emqx_telemetry/src/emqx_telemetry.erl +++ b/apps/emqx_telemetry/src/emqx_telemetry.erl @@ -132,6 +132,12 @@ get_telemetry() -> %% 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]) -> State = #state{url = get_value(url, Opts), report_interval = timer:seconds(get_value(report_interval, Opts))}, @@ -409,4 +415,4 @@ module_attributes(Module) -> bin(L) when is_list(L) -> list_to_binary(L); bin(B) when is_binary(B) -> - B. \ No newline at end of file + B.