Просмотр исходного кода

fix(emqx_acl_cache): Dialyzer warnings

Zaiming Shi 5 лет назад
Родитель
Сommit
0d90d5c66b
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      src/emqx_acl_cache.erl

+ 5 - 3
src/emqx_acl_cache.erl

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