diff --git a/apps/emqx/src/emqx_channel.erl b/apps/emqx/src/emqx_channel.erl index 69e0a55f7..3fb6a5f6b 100644 --- a/apps/emqx/src/emqx_channel.erl +++ b/apps/emqx/src/emqx_channel.erl @@ -2136,7 +2136,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. 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.