25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

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

View File

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