mod_mam_mnesia: Fix check for empty archive

Don't return 'true' if the key exists but points to an empty archive.
Also, avoid looking up all keys.
This commit is contained in:
Holger Weiss 2019-02-21 22:19:29 +01:00
parent 1684436bfe
commit 9a3a7369cb
1 changed files with 1 additions and 2 deletions

View File

@ -200,8 +200,7 @@ select(_LServer, JidRequestor,
Result.
is_empty_for_user(LUser, LServer) ->
not lists:member({LUser, LServer},
mnesia:dirty_all_keys(archive_msg)).
mnesia:dirty_read(archive_msg, {LUser, LServer}) == [].
is_empty_for_room(_LServer, LName, LHost) ->
is_empty_for_user(LName, LHost).