fix(emqx_acl_cache): Dialyzer warnings

This commit is contained in:
Zaiming Shi 2020-11-04 13:41:48 +01:00
parent d4aa5ebf55
commit 0d90d5c66b
1 changed files with 5 additions and 3 deletions

View File

@ -107,9 +107,7 @@ put_acl_cache(PubSub, Topic, AclResult) ->
%% delete all the acl entries %% delete all the acl entries
-spec(empty_acl_cache() -> ok). -spec(empty_acl_cache() -> ok).
empty_acl_cache() -> empty_acl_cache() ->
map_acl_cache(fun({CacheK, _CacheV}) -> foreach_acl_cache(fun({CacheK, _CacheV}) -> erlang:erase(CacheK) end),
erlang:erase(CacheK)
end),
set_cache_size(0), set_cache_size(0),
keys_queue_set(queue:new()). keys_queue_set(queue:new()).
@ -139,9 +137,13 @@ get_cache_size() ->
dump_acl_cache() -> dump_acl_cache() ->
map_acl_cache(fun(Cache) -> Cache end). map_acl_cache(fun(Cache) -> Cache end).
map_acl_cache(Fun) -> map_acl_cache(Fun) ->
[Fun(R) || R = {{SubPub, _T}, _Acl} <- get(), SubPub =:= publish [Fun(R) || R = {{SubPub, _T}, _Acl} <- get(), SubPub =:= publish
orelse SubPub =:= subscribe]. orelse SubPub =:= subscribe].
foreach_acl_cache(Fun) ->
_ = map_acl_cache(Fun),
ok.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Internal functions %% Internal functions