mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Fix mam delete_old_messages_batch for sql backend
Too much copy/paste from spool equivalent...
This commit is contained in:
parent
382c3836af
commit
a2efde185a
@ -581,8 +581,8 @@ delete_old_messages_batch(Server, Type, Days, BatchSize, Rate) when Type == <<"c
|
||||
|
||||
case ejabberd_batch:register_task({mam, LServer}, 0, Rate, {LServer, TypeA, TimeStamp, BatchSize, none},
|
||||
fun({L, T, St, B, IS} = S) ->
|
||||
case {erlang:function_exported(Mod, remove_old_messages_batch, 4),
|
||||
erlang:function_exported(Mod, remove_old_messages_batch, 5)} of
|
||||
case {erlang:function_exported(Mod, delete_old_messages_batch, 4),
|
||||
erlang:function_exported(Mod, delete_old_messages_batch, 5)} of
|
||||
{true, _} ->
|
||||
case Mod:delete_old_messages_batch(L, St, T, B) of
|
||||
{ok, Count} ->
|
||||
@ -591,7 +591,7 @@ delete_old_messages_batch(Server, Type, Days, BatchSize, Rate) when Type == <<"c
|
||||
E
|
||||
end;
|
||||
{_, true} ->
|
||||
case Mod:remove_old_messages_batch(L, St, T, B, IS) of
|
||||
case Mod:delete_old_messages_batch(L, St, T, B, IS) of
|
||||
{ok, IS2, Count} ->
|
||||
{ok, {L, St, T, B, IS2}, Count};
|
||||
{error, _} = E ->
|
||||
|
@ -29,7 +29,7 @@
|
||||
%% API
|
||||
-export([init/2, remove_user/2, remove_room/3, delete_old_messages/3,
|
||||
extended_fields/0, store/8, write_prefs/4, get_prefs/2, select/6, remove_from_archive/3,
|
||||
is_empty_for_user/2, is_empty_for_room/3, remove_old_messages_batch/5]).
|
||||
is_empty_for_user/2, is_empty_for_room/3, delete_old_messages_batch/5]).
|
||||
|
||||
-include_lib("stdlib/include/ms_transform.hrl").
|
||||
-include_lib("xmpp/include/xmpp.hrl").
|
||||
@ -155,7 +155,7 @@ delete_batch(LastUS, LServer, TS, Type, Num) ->
|
||||
_ -> delete_batch(mnesia:next(archive_msg, LastUS), LServer, TS, Type, Left)
|
||||
end.
|
||||
|
||||
remove_old_messages_batch(LServer, TimeStamp, Type, Batch, LastUS) ->
|
||||
delete_old_messages_batch(LServer, TimeStamp, Type, Batch, LastUS) ->
|
||||
R = mnesia:transaction(
|
||||
fun() ->
|
||||
{Num, NextUS} = delete_batch(LastUS, LServer, TimeStamp, Type, Batch),
|
||||
|
Loading…
Reference in New Issue
Block a user