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

fix(dialyzer): Fix problems found by dialyzer

k32 4 лет назад
Родитель
Сommit
37a1c45af0

+ 1 - 1
apps/emqx/src/emqx_banned.erl

@@ -191,7 +191,7 @@ handle_cast(Msg, State) ->
     {noreply, State}.
 
 handle_info({timeout, TRef, expire}, State = #{expiry_timer := TRef}) ->
-    mria:transaction(?COMMON_SHARD, fun expire_banned_items/1, [erlang:system_time(second)]),
+    _ = mria:transaction(?COMMON_SHARD, fun expire_banned_items/1, [erlang:system_time(second)]),
     {noreply, ensure_expiry_timer(State), hibernate};
 
 handle_info(Info, State) ->

+ 1 - 1
apps/emqx/src/emqx_router_helper.erl

@@ -132,7 +132,7 @@ handle_info({mnesia_table_event, Event}, State) ->
 handle_info({nodedown, Node}, State = #{nodes := Nodes}) ->
     global:trans({?LOCK, self()},
                  fun() ->
-                     mria:transaction(fun cleanup_routes/1, [Node])
+                     mria:transaction(?ROUTE_SHARD, fun cleanup_routes/1, [Node])
                  end),
     ok = mria:dirty_delete(?ROUTING_NODE, Node),
     {noreply, State#{nodes := lists:delete(Node, Nodes)}, hibernate};

+ 2 - 2
apps/emqx_dashboard/src/emqx_dashboard_collection.erl

@@ -159,8 +159,8 @@ flush({Connection, Route, Subscription}, {Received0, Sent0, Dropped0}) ->
                diff(Sent, Sent0),
                diff(Dropped, Dropped0)},
     Ts = get_local_time(),
-    mria:transaction(mria:local_content_shard(),
-        fun mnesia:write/1, [#mqtt_collect{timestamp = Ts, collect = Collect}]),
+    _ = mria:transaction(mria:local_content_shard(),
+                         fun mnesia:write/1, [#mqtt_collect{timestamp = Ts, collect = Collect}]),
     {Received, Sent, Dropped}.
 
 avg(Items) ->

+ 1 - 1
apps/emqx_dashboard/src/emqx_dashboard_token.erl

@@ -101,7 +101,7 @@ do_sign(Username, Password) ->
     Signed = jose_jwt:sign(JWK, JWS, JWT),
     {_, Token} = jose_jws:compact(Signed),
     JWTRec = format(Token, Username, ExpTime),
-    mria:transaction(?DASHBOARD_SHARD, fun mnesia:write/1, [JWTRec]),
+    _ = mria:transaction(?DASHBOARD_SHARD, fun mnesia:write/1, [JWTRec]),
     {ok, Token}.
 
 do_verify(Token)->

+ 1 - 1
apps/emqx_machine/src/emqx_machine.erl

@@ -36,7 +36,7 @@ start() ->
     ok = print_otp_version_warning(),
     ok = load_config_files(),
     ekka:start(),
-    mria_rlog:wait_for_shards([?EMQX_MACHINE_SHARD], infinity),
+    ok = mria_rlog:wait_for_shards([?EMQX_MACHINE_SHARD], infinity),
     ok.
 
 graceful_shutdown() ->

+ 3 - 7
apps/emqx_retainer/src/emqx_retainer_mnesia.erl

@@ -116,12 +116,8 @@ delete_message(_, Topic) ->
             Fun = fun() ->
                        mnesia:delete({?TAB, Tokens})
                   end,
-            case mria:transaction(?RETAINER_SHARD, Fun) of
-                {atomic, Result} ->
-                    Result;
-                ok ->
-                    ok
-                end
+            _ = mria:transaction(?RETAINER_SHARD, Fun),
+            ok
     end,
     ok.
 
@@ -156,7 +152,7 @@ match_messages(_, Topic, Cursor) ->
     end.
 
 clean(_) ->
-    mria:clear_table(?TAB),
+    _ = mria:clear_table(?TAB),
     ok.
 %%--------------------------------------------------------------------
 %% Internal functions