Просмотр исходного кода

Merge pull request #10682 from lafirest/fix/will_msg_timestamp

fix: update the will message timestamp when it is ready to publish
lafirest 2 лет назад
Родитель
Сommit
67ada52808
2 измененных файлов с 3 добавлено и 1 удалено
  1. 2 1
      apps/emqx/src/emqx_channel.erl
  2. 1 0
      changes/ce/fix-10682.en.md

+ 2 - 1
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.
 

+ 1 - 0
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.