mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
When applying limit of max msgs in spool check only spool size
This commit is contained in:
parent
8207ea18bf
commit
7d23cd2899
@ -195,7 +195,7 @@ store_offline_msg(#offline_msg{us = {User, Server}, packet = Pkt} = Msg) ->
|
|||||||
infinity ->
|
infinity ->
|
||||||
Mod:store_message(Msg);
|
Mod:store_message(Msg);
|
||||||
Limit ->
|
Limit ->
|
||||||
Num = count_offline_messages(User, Server),
|
Num = count_messages_in_db(User, Server),
|
||||||
if Num < Limit ->
|
if Num < Limit ->
|
||||||
Mod:store_message(Msg);
|
Mod:store_message(Msg);
|
||||||
true ->
|
true ->
|
||||||
@ -1053,10 +1053,14 @@ count_offline_messages(User, Server) ->
|
|||||||
Res = read_db_messages(LUser, LServer),
|
Res = read_db_messages(LUser, LServer),
|
||||||
count_mam_messages(LUser, LServer, Res);
|
count_mam_messages(LUser, LServer, Res);
|
||||||
_ ->
|
_ ->
|
||||||
Mod = gen_mod:db_mod(LServer, ?MODULE),
|
count_messages_in_db(LUser, LServer)
|
||||||
Mod:count_messages(LUser, LServer)
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
-spec count_messages_in_db(binary(), binary()) -> non_neg_integer().
|
||||||
|
count_messages_in_db(LUser, LServer) ->
|
||||||
|
Mod = gen_mod:db_mod(LServer, ?MODULE),
|
||||||
|
Mod:count_messages(LUser, LServer).
|
||||||
|
|
||||||
-spec add_delay_info(message(), binary(),
|
-spec add_delay_info(message(), binary(),
|
||||||
undefined | erlang:timestamp()) -> message().
|
undefined | erlang:timestamp()) -> message().
|
||||||
add_delay_info(Packet, LServer, TS) ->
|
add_delay_info(Packet, LServer, TS) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user