fix(emqx_channel): Dialyzer warning

This commit is contained in:
Zaiming Shi 2020-11-04 17:25:40 +01:00
parent cfe52cbb8d
commit 7dd67a6caf
1 changed files with 9 additions and 4 deletions

View File

@ -1540,15 +1540,20 @@ mabye_publish_will_msg(Channel = #channel{will_msg = undefined}) ->
Channel; Channel;
mabye_publish_will_msg(Channel = #channel{will_msg = WillMsg}) -> mabye_publish_will_msg(Channel = #channel{will_msg = WillMsg}) ->
case will_delay_interval(WillMsg) of case will_delay_interval(WillMsg) of
0 -> publish_will_msg(WillMsg), 0 ->
ok = publish_will_msg(WillMsg),
Channel#channel{will_msg = undefined}; Channel#channel{will_msg = undefined};
I -> ensure_timer(will_timer, timer:seconds(I), Channel) I ->
ensure_timer(will_timer, timer:seconds(I), Channel)
end. end.
will_delay_interval(WillMsg) -> will_delay_interval(WillMsg) ->
maps:get('Will-Delay-Interval', emqx_message:get_header(properties, WillMsg), 0). maps:get('Will-Delay-Interval', emqx_message:get_header(properties, WillMsg), 0).
publish_will_msg(Msg) -> emqx_broker:publish(Msg). publish_will_msg(Msg) ->
%% TODO check if we should discard result here
_ = emqx_broker:publish(Msg),
ok.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Disconnect Reason %% Disconnect Reason