fix(emqx_retainer): refresh the timestamp when dispatch retained message (#6148)

This commit is contained in:
lafirest 2021-11-12 14:51:02 +08:00 committed by GitHub
parent e7bbe98a7a
commit 66d0c44e36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -78,7 +78,8 @@ dispatch(Pid, Topic) ->
false -> read_messages(Topic); false -> read_messages(Topic);
true -> match_messages(Topic) true -> match_messages(Topic)
end, end,
[Pid ! {deliver, Topic, Msg} || Msg <- sort_retained(Msgs)]. Now = erlang:system_time(millisecond),
[Pid ! {deliver, Topic, Msg#message{timestamp = Now}} || Msg <- sort_retained(Msgs)].
%% RETAIN flag set to 1 and payload containing zero bytes %% RETAIN flag set to 1 and payload containing zero bytes
on_message_publish(Msg = #message{flags = #{retain := true}, on_message_publish(Msg = #message{flags = #{retain := true},