fix(dialyzer): Fix problems found by dialyzer

This commit is contained in:
k32 2021-10-18 17:13:11 +02:00 committed by x1001100011
parent 69126fede6
commit 760d896d9d
6 changed files with 9 additions and 13 deletions

View File

@ -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) ->

View File

@ -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};

View File

@ -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) ->

View File

@ -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)->

View File

@ -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() ->

View File

@ -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