From b2f53fb9622f514de49adc11fb034a7019afbe1b Mon Sep 17 00:00:00 2001 From: Christophe Romain Date: Tue, 21 Jun 2016 10:43:19 +0200 Subject: [PATCH] Avoid cleanup on bag when disc_only, switch in memory (#1161) --- src/mod_mam_mnesia.erl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mod_mam_mnesia.erl b/src/mod_mam_mnesia.erl index 10b98daf7..2463690fd 100644 --- a/src/mod_mam_mnesia.erl +++ b/src/mod_mam_mnesia.erl @@ -52,7 +52,10 @@ remove_room(_LServer, LName, LHost) -> remove_user(LName, LHost). delete_old_messages(global, TimeStamp, Type) -> - delete_old_user_messages(mnesia:dirty_first(archive_msg), TimeStamp, Type). + mnesia:change_table_copy_type(archive_msg, node(), disc_copies), + Result = delete_old_user_messages(mnesia:dirty_first(archive_msg), TimeStamp, Type), + mnesia:change_table_copy_type(archive_msg, node(), disc_only_copies), + Result. delete_old_user_messages('$end_of_table', _TimeStamp, _Type) -> ok;