소스 검색

fix(emqx_resource): some dialyzer complaints

Shawn 4 년 전
부모
커밋
696d4a4e58
2개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      apps/emqx_resource/rebar.config
  2. 2 0
      apps/emqx_resource/src/emqx_resource_instance.erl

+ 2 - 0
apps/emqx_resource/rebar.config

@@ -7,6 +7,8 @@
 
 
 {extra_src_dirs, ["examples"]}.
 {extra_src_dirs, ["examples"]}.
 
 
+%% try to override the dialyzer 'race_conditions' defined in the top-level dir,
+%% but it doesn't work
 {dialyzer, [{warnings, [unmatched_returns, error_handling]}
 {dialyzer, [{warnings, [unmatched_returns, error_handling]}
            ]}.
            ]}.
 
 

+ 2 - 0
apps/emqx_resource/src/emqx_resource_instance.erl

@@ -175,6 +175,8 @@ code_change(_OldVsn, State, _Extra) ->
 
 
 %%------------------------------------------------------------------------------
 %%------------------------------------------------------------------------------
 
 
+%% suppress the race condition check, as these functions are protected in gproc workers
+-dialyzer({nowarn_function, [do_update/4, do_create/3, do_restart/1, do_stop/1, do_health_check/1]}).
 do_update(InstId, ResourceType, NewConfig, Params) ->
 do_update(InstId, ResourceType, NewConfig, Params) ->
     case lookup(InstId) of
     case lookup(InstId) of
         {ok, #{mod := ResourceType, state := ResourceState, config := OldConfig}} ->
         {ok, #{mod := ResourceType, state := ResourceState, config := OldConfig}} ->