fix(emqx_plugins, emqx_sys, emqx_sys_mon, emqx_ws_connection): Dialyzer warnings
This commit is contained in:
parent
39883bdab1
commit
18ae158f45
|
@ -65,7 +65,7 @@ load() ->
|
|||
case emqx:get_env(plugins_loaded_file) of
|
||||
undefined -> ignore; %% No plugins available
|
||||
File ->
|
||||
ensure_file(File),
|
||||
_ = ensure_file(File),
|
||||
with_loaded_file(File, fun(Names) -> load_plugins(Names, false) end)
|
||||
end.
|
||||
|
||||
|
@ -165,7 +165,7 @@ load_expand_plugins() ->
|
|||
load_expand_plugin(PluginDir) ->
|
||||
init_expand_plugin_config(PluginDir),
|
||||
Ebin = filename:join([PluginDir, "ebin"]),
|
||||
code:add_patha(Ebin),
|
||||
_ = code:add_patha(Ebin),
|
||||
Modules = filelib:wildcard(filename:join([Ebin, "*.beam"])),
|
||||
lists:foreach(fun(Mod) ->
|
||||
Module = list_to_atom(filename:basename(Mod, ".beam")),
|
||||
|
@ -246,7 +246,7 @@ apply_configs([{App, Config} | More]) ->
|
|||
|
||||
%% Stop plugins
|
||||
stop_plugins(Names) ->
|
||||
[stop_app(App) || App <- Names],
|
||||
_ = [stop_app(App) || App <- Names],
|
||||
ok.
|
||||
|
||||
plugin(AppName, Type) ->
|
||||
|
@ -297,7 +297,7 @@ start_app(App, SuccFun) ->
|
|||
unload_plugin(App, Persistent) ->
|
||||
case stop_app(App) of
|
||||
ok ->
|
||||
plugin_unloaded(App, Persistent), ok;
|
||||
_ = plugin_unloaded(App, Persistent), ok;
|
||||
{error, Reason} ->
|
||||
{error, Reason}
|
||||
end.
|
||||
|
|
|
@ -151,16 +151,16 @@ handle_cast(Msg, State) ->
|
|||
{noreply, State}.
|
||||
|
||||
handle_info({timeout, TRef, heartbeat}, State = #state{heartbeat = TRef}) ->
|
||||
publish(uptime, iolist_to_binary(uptime(State))),
|
||||
publish(datetime, iolist_to_binary(datetime())),
|
||||
_ = publish(uptime, iolist_to_binary(uptime(State))),
|
||||
_ = publish(datetime, iolist_to_binary(datetime())),
|
||||
{noreply, heartbeat(State)};
|
||||
|
||||
handle_info({timeout, TRef, tick}, State = #state{ticker = TRef, version = Version, sysdescr = Descr}) ->
|
||||
publish(version, Version),
|
||||
publish(sysdescr, Descr),
|
||||
publish(brokers, ekka_mnesia:running_nodes()),
|
||||
publish(stats, emqx_stats:getstats()),
|
||||
publish(metrics, emqx_metrics:all()),
|
||||
_ = publish(version, Version),
|
||||
_ = publish(sysdescr, Descr),
|
||||
_ = publish(brokers, ekka_mnesia:running_nodes()),
|
||||
_ = publish(stats, emqx_stats:getstats()),
|
||||
_ = publish(metrics, emqx_metrics:all()),
|
||||
{noreply, tick(State), hibernate};
|
||||
|
||||
handle_info(Info, State) ->
|
||||
|
|
|
@ -55,7 +55,7 @@ start_link(Opts) ->
|
|||
%%--------------------------------------------------------------------
|
||||
|
||||
init([Opts]) ->
|
||||
erlang:system_monitor(self(), parse_opt(Opts)),
|
||||
_ = erlang:system_monitor(self(), parse_opt(Opts)),
|
||||
emqx_logger:set_proc_metadata(#{sysmon => true}),
|
||||
|
||||
%% Monitor cluster partition event
|
||||
|
@ -174,7 +174,7 @@ suppress(Key, SuccFun, State = #{events := Events}) ->
|
|||
true ->
|
||||
{noreply, State};
|
||||
false ->
|
||||
SuccFun(),
|
||||
_ = SuccFun(),
|
||||
{noreply, State#{events := [Key|Events]}}
|
||||
end.
|
||||
|
||||
|
|
|
@ -568,33 +568,33 @@ serialize_and_inc_stats_fun(#state{serialize = Serialize}) ->
|
|||
]}).
|
||||
|
||||
inc_recv_stats(Cnt, Oct) ->
|
||||
emqx_pd:inc_counter(incoming_bytes, Oct),
|
||||
emqx_pd:inc_counter(recv_cnt, Cnt),
|
||||
emqx_pd:inc_counter(recv_oct, Oct),
|
||||
_ = emqx_pd:inc_counter(incoming_bytes, Oct),
|
||||
_ = emqx_pd:inc_counter(recv_cnt, Cnt),
|
||||
_ = emqx_pd:inc_counter(recv_oct, Oct),
|
||||
emqx_metrics:inc('bytes.received', Oct).
|
||||
|
||||
inc_incoming_stats(Packet = ?PACKET(Type)) ->
|
||||
emqx_pd:inc_counter(recv_pkt, 1),
|
||||
_ = emqx_pd:inc_counter(recv_pkt, 1),
|
||||
if Type == ?PUBLISH ->
|
||||
emqx_pd:inc_counter(recv_msg, 1),
|
||||
emqx_pd:inc_counter(incoming_pubs, 1);
|
||||
_ = emqx_pd:inc_counter(recv_msg, 1),
|
||||
_ = emqx_pd:inc_counter(incoming_pubs, 1);
|
||||
true -> ok
|
||||
end,
|
||||
emqx_metrics:inc_recv(Packet).
|
||||
|
||||
inc_outgoing_stats(Packet = ?PACKET(Type)) ->
|
||||
emqx_pd:inc_counter(send_pkt, 1),
|
||||
_ = emqx_pd:inc_counter(send_pkt, 1),
|
||||
if Type == ?PUBLISH ->
|
||||
emqx_pd:inc_counter(send_msg, 1),
|
||||
emqx_pd:inc_counter(outgoing_pubs, 1);
|
||||
_ = emqx_pd:inc_counter(send_msg, 1),
|
||||
_ = emqx_pd:inc_counter(outgoing_pubs, 1);
|
||||
true -> ok
|
||||
end,
|
||||
emqx_metrics:inc_sent(Packet).
|
||||
|
||||
inc_sent_stats(Cnt, Oct) ->
|
||||
emqx_pd:inc_counter(outgoing_bytes, Oct),
|
||||
emqx_pd:inc_counter(send_cnt, Cnt),
|
||||
emqx_pd:inc_counter(send_oct, Oct),
|
||||
_ = emqx_pd:inc_counter(outgoing_bytes, Oct),
|
||||
_ = emqx_pd:inc_counter(send_cnt, Cnt),
|
||||
_ = emqx_pd:inc_counter(send_oct, Oct),
|
||||
emqx_metrics:inc('bytes.sent', Oct).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue