This commit is contained in:
Feng 2016-04-12 15:11:01 +08:00
parent b257423730
commit 3733574105
1 changed files with 3 additions and 1 deletions

View File

@ -96,7 +96,9 @@ expire_messages(Time) when is_integer(Time) ->
when Time > (MegaSecs * 1000000 + Secs) -> Topic when Time > (MegaSecs * 1000000 + Secs) -> Topic
end), end),
Topics = mnesia:select(retained_message, Match, write), Topics = mnesia:select(retained_message, Match, write),
lists:foreach(fun(Topic) -> mnesia:delete({retained_message, Topic}) end, Topics) lists:foreach(fun(<<"$SYS/", _/binary>>) -> ok; %% ignore $SYS/# messages
(Topic) -> mnesia:delete({retained_message, Topic})
end, Topics)
end). end).
-spec(retained_count() -> non_neg_integer()). -spec(retained_count() -> non_neg_integer()).