fix(dialyzer): Fix problems found by dialyzer
This commit is contained in:
parent
07ea6e5689
commit
37a1c45af0
|
@ -191,7 +191,7 @@ handle_cast(Msg, State) ->
|
||||||
{noreply, State}.
|
{noreply, State}.
|
||||||
|
|
||||||
handle_info({timeout, TRef, expire}, State = #{expiry_timer := TRef}) ->
|
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};
|
{noreply, ensure_expiry_timer(State), hibernate};
|
||||||
|
|
||||||
handle_info(Info, State) ->
|
handle_info(Info, State) ->
|
||||||
|
|
|
@ -132,7 +132,7 @@ handle_info({mnesia_table_event, Event}, State) ->
|
||||||
handle_info({nodedown, Node}, State = #{nodes := Nodes}) ->
|
handle_info({nodedown, Node}, State = #{nodes := Nodes}) ->
|
||||||
global:trans({?LOCK, self()},
|
global:trans({?LOCK, self()},
|
||||||
fun() ->
|
fun() ->
|
||||||
mria:transaction(fun cleanup_routes/1, [Node])
|
mria:transaction(?ROUTE_SHARD, fun cleanup_routes/1, [Node])
|
||||||
end),
|
end),
|
||||||
ok = mria:dirty_delete(?ROUTING_NODE, Node),
|
ok = mria:dirty_delete(?ROUTING_NODE, Node),
|
||||||
{noreply, State#{nodes := lists:delete(Node, Nodes)}, hibernate};
|
{noreply, State#{nodes := lists:delete(Node, Nodes)}, hibernate};
|
||||||
|
|
|
@ -159,8 +159,8 @@ flush({Connection, Route, Subscription}, {Received0, Sent0, Dropped0}) ->
|
||||||
diff(Sent, Sent0),
|
diff(Sent, Sent0),
|
||||||
diff(Dropped, Dropped0)},
|
diff(Dropped, Dropped0)},
|
||||||
Ts = get_local_time(),
|
Ts = get_local_time(),
|
||||||
mria:transaction(mria:local_content_shard(),
|
_ = mria:transaction(mria:local_content_shard(),
|
||||||
fun mnesia:write/1, [#mqtt_collect{timestamp = Ts, collect = Collect}]),
|
fun mnesia:write/1, [#mqtt_collect{timestamp = Ts, collect = Collect}]),
|
||||||
{Received, Sent, Dropped}.
|
{Received, Sent, Dropped}.
|
||||||
|
|
||||||
avg(Items) ->
|
avg(Items) ->
|
||||||
|
|
|
@ -101,7 +101,7 @@ do_sign(Username, Password) ->
|
||||||
Signed = jose_jwt:sign(JWK, JWS, JWT),
|
Signed = jose_jwt:sign(JWK, JWS, JWT),
|
||||||
{_, Token} = jose_jws:compact(Signed),
|
{_, Token} = jose_jws:compact(Signed),
|
||||||
JWTRec = format(Token, Username, ExpTime),
|
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}.
|
{ok, Token}.
|
||||||
|
|
||||||
do_verify(Token)->
|
do_verify(Token)->
|
||||||
|
|
|
@ -36,7 +36,7 @@ start() ->
|
||||||
ok = print_otp_version_warning(),
|
ok = print_otp_version_warning(),
|
||||||
ok = load_config_files(),
|
ok = load_config_files(),
|
||||||
ekka:start(),
|
ekka:start(),
|
||||||
mria_rlog:wait_for_shards([?EMQX_MACHINE_SHARD], infinity),
|
ok = mria_rlog:wait_for_shards([?EMQX_MACHINE_SHARD], infinity),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
graceful_shutdown() ->
|
graceful_shutdown() ->
|
||||||
|
|
|
@ -116,12 +116,8 @@ delete_message(_, Topic) ->
|
||||||
Fun = fun() ->
|
Fun = fun() ->
|
||||||
mnesia:delete({?TAB, Tokens})
|
mnesia:delete({?TAB, Tokens})
|
||||||
end,
|
end,
|
||||||
case mria:transaction(?RETAINER_SHARD, Fun) of
|
_ = mria:transaction(?RETAINER_SHARD, Fun),
|
||||||
{atomic, Result} ->
|
ok
|
||||||
Result;
|
|
||||||
ok ->
|
|
||||||
ok
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
@ -156,7 +152,7 @@ match_messages(_, Topic, Cursor) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
clean(_) ->
|
clean(_) ->
|
||||||
mria:clear_table(?TAB),
|
_ = mria:clear_table(?TAB),
|
||||||
ok.
|
ok.
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Internal functions
|
%% Internal functions
|
||||||
|
|
Loading…
Reference in New Issue