Merge pull request #10682 from lafirest/fix/will_msg_timestamp

fix: update the will message timestamp when it is ready to publish
This commit is contained in:
lafirest 2023-05-12 22:25:32 +08:00 committed by GitHub
commit 67ada52808
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -2136,7 +2136,8 @@ publish_will_msg(
ok; ok;
false -> false ->
NMsg = emqx_mountpoint:mount(MountPoint, Msg), NMsg = emqx_mountpoint:mount(MountPoint, Msg),
_ = emqx_broker:publish(NMsg), NMsg2 = NMsg#message{timestamp = erlang:system_time(millisecond)},
_ = emqx_broker:publish(NMsg2),
ok ok
end. end.

View File

@ -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.