diff --git a/src/emqx_channel.erl b/src/emqx_channel.erl index 71b89f153..cc5394cd9 100644 --- a/src/emqx_channel.erl +++ b/src/emqx_channel.erl @@ -1540,15 +1540,20 @@ mabye_publish_will_msg(Channel = #channel{will_msg = undefined}) -> Channel; mabye_publish_will_msg(Channel = #channel{will_msg = WillMsg}) -> case will_delay_interval(WillMsg) of - 0 -> publish_will_msg(WillMsg), - Channel#channel{will_msg = undefined}; - I -> ensure_timer(will_timer, timer:seconds(I), Channel) + 0 -> + ok = publish_will_msg(WillMsg), + Channel#channel{will_msg = undefined}; + I -> + ensure_timer(will_timer, timer:seconds(I), Channel) end. will_delay_interval(WillMsg) -> 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