From c1c24af002a7e4b51ff42c5f335a42c3693e22dd Mon Sep 17 00:00:00 2001 From: zhongwencool Date: Thu, 26 Aug 2021 18:12:21 +0800 Subject: [PATCH] fix: dialyzer warning --- apps/emqx_authz/src/emqx_authz.erl | 1 - apps/emqx_machine/src/emqx_cluster_rpc.erl | 4 ++-- apps/emqx_resource/src/emqx_resource.erl | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/emqx_authz/src/emqx_authz.erl b/apps/emqx_authz/src/emqx_authz.erl index bbe4caa6b..e082b9995 100644 --- a/apps/emqx_authz/src/emqx_authz.erl +++ b/apps/emqx_authz/src/emqx_authz.erl @@ -216,7 +216,6 @@ create_resource(#{type := DB, Config, []) of - {ok, already_created} -> ResourceID; {ok, _} -> ResourceID; {error, Reason} -> {error, Reason} end; diff --git a/apps/emqx_machine/src/emqx_cluster_rpc.erl b/apps/emqx_machine/src/emqx_cluster_rpc.erl index 4c7576ff3..c2b2d086d 100644 --- a/apps/emqx_machine/src/emqx_cluster_rpc.erl +++ b/apps/emqx_machine/src/emqx_cluster_rpc.erl @@ -69,7 +69,7 @@ start_link() -> start_link(Node, Name, RetryMs) -> gen_server:start_link({local, Name}, ?MODULE, [Node, RetryMs], []). --spec multicall(Module, Function, Args) -> {ok, TnxId} | {error, Reason} when +-spec multicall(Module, Function, Args) -> {ok, TnxId, term()} | {error, Reason} when Module :: module(), Function :: atom(), Args :: [term()], @@ -78,7 +78,7 @@ start_link(Node, Name, RetryMs) -> multicall(M, F, A) -> multicall(M, F, A, timer:minutes(2)). --spec multicall(Module, Function, Args, Timeout) -> {ok, TnxId} |{error, Reason} when +-spec multicall(Module, Function, Args, Timeout) -> {ok, TnxId, term()} |{error, Reason} when Module :: module(), Function :: atom(), Args :: [term()], diff --git a/apps/emqx_resource/src/emqx_resource.erl b/apps/emqx_resource/src/emqx_resource.erl index 4bc1d20f0..cad32bcb2 100644 --- a/apps/emqx_resource/src/emqx_resource.erl +++ b/apps/emqx_resource/src/emqx_resource.erl @@ -155,12 +155,12 @@ query_failed({_, {OnFailed, Args}}) -> %% APIs for resource instances %% ================================================================================= -spec create(instance_id(), resource_type(), resource_config()) -> - {ok, resource_data()} | {error, Reason :: term()}. + {ok, resource_data() |'already_created'} | {error, Reason :: term()}. create(InstId, ResourceType, Config) -> cluster_call(create_local, [InstId, ResourceType, Config]). -spec create_local(instance_id(), resource_type(), resource_config()) -> - {ok, resource_data()} | {error, Reason :: term()}. + {ok, resource_data() | 'already_created'} | {error, Reason :: term()}. create_local(InstId, ResourceType, Config) -> call_instance(InstId, {create, InstId, ResourceType, Config}). @@ -285,7 +285,7 @@ check_config(ResourceType, RawConfigTerm) -> end. -spec check_and_create(instance_id(), resource_type(), raw_resource_config()) -> - {ok, resource_data()} | {error, term()}. + {ok, resource_data() |'already_created'} | {error, term()}. check_and_create(InstId, ResourceType, RawConfig) -> check_and_do(ResourceType, RawConfig, fun(InstConf) -> create(InstId, ResourceType, InstConf) end).