From dcd4640a57602fb9f741ca13717fca6e070c849b Mon Sep 17 00:00:00 2001 From: firest Date: Fri, 12 May 2023 14:28:26 +0800 Subject: [PATCH 1/2] 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. From 2404d167c8763d8079021e98a1388d89d6fea187 Mon Sep 17 00:00:00 2001 From: firest Date: Fri, 12 May 2023 14:39:18 +0800 Subject: [PATCH 2/2] chore: update changes --- changes/ce/fix-10682.en.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/ce/fix-10682.en.md diff --git a/changes/ce/fix-10682.en.md b/changes/ce/fix-10682.en.md new file mode 100644 index 000000000..df8d93116 --- /dev/null +++ b/changes/ce/fix-10682.en.md @@ -0,0 +1 @@ +Fix the timestamp for the will message is incorrectly assigned at the session creation time, now this timestamp is the disconnected time of the session.