25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-26 17:38:45 +01:00

Get next record before deleting previous on, in case it's last one (#2069)

This commit is contained in:
Badlop 2017-10-25 12:58:07 +02:00
parent 8028a9545a
commit e4054aab79

View File

@ -91,10 +91,10 @@ delete_old_user_messages(User, TimeStamp, Type) ->
ok
end
end,
NextRecord = mnesia:dirty_next(archive_msg, User),
case mnesia:transaction(F) of
{atomic, ok} ->
delete_old_user_messages(mnesia:dirty_next(archive_msg, User),
TimeStamp, Type);
delete_old_user_messages(NextRecord, TimeStamp, Type);
{aborted, Err} ->
?ERROR_MSG("Cannot delete old MAM messages: ~s", [Err]),
Err