From dcd4640a57602fb9f741ca13717fca6e070c849b Mon Sep 17 00:00:00 2001 From: firest Date: Fri, 12 May 2023 14:28:26 +0800 Subject: [PATCH] fix: update the will message timestamp when it is ready to publish --- apps/emqx/src/emqx_channel.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/emqx/src/emqx_channel.erl b/apps/emqx/src/emqx_channel.erl index 862b72c06..b8e0233fb 100644 --- a/apps/emqx/src/emqx_channel.erl +++ b/apps/emqx/src/emqx_channel.erl @@ -2146,7 +2146,8 @@ publish_will_msg( ok; false -> NMsg = emqx_mountpoint:mount(MountPoint, Msg), - _ = emqx_broker:publish(NMsg), + NMsg2 = NMsg#message{timestamp = erlang:system_time(millisecond)}, + _ = emqx_broker:publish(NMsg2), ok end.