mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
* src/mod_offline.erl: Only count messages if a quota has been
actually set (EJAB-314). * src/p1_mnesia.erl: Minor coding style change. SVN Revision: 860
This commit is contained in:
parent
9d03ea3f98
commit
4e82569bcb
@ -1,3 +1,9 @@
|
||||
2007-08-08 Mickael Remond <mickael.remond@process-one.net>
|
||||
|
||||
* src/mod_offline.erl: Only count messages if a quota has been
|
||||
actually set (EJAB-314).
|
||||
* src/p1_mnesia.erl: Minor coding style change.
|
||||
|
||||
2007-08-07 Mickael Remond <mickael.remond@process-one.net>
|
||||
|
||||
* src/mod_offline.erl: Started implementation of mod_offline
|
||||
|
@ -59,9 +59,14 @@ loop() ->
|
||||
Msgs = receive_all(US, [Msg]),
|
||||
Len = length(Msgs),
|
||||
F = fun() ->
|
||||
Count = Len + p1_mnesia:count_records(
|
||||
offline_msg,
|
||||
#offline_msg{us=US, _='_'}),
|
||||
%% Only count messages if needed:
|
||||
Count = if ?MAX_OFFLINE_MSGS == infinity ->
|
||||
Len + p1_mnesia:count_records(
|
||||
offline_msg,
|
||||
#offline_msg{us=US, _='_'});
|
||||
true ->
|
||||
0
|
||||
end,
|
||||
if
|
||||
Count > ?MAX_OFFLINE_MSGS ->
|
||||
%% TODO: Warn that messages have been discarded
|
||||
|
@ -26,9 +26,9 @@
|
||||
%% getting the record by small increment and by using continuation.
|
||||
-define(BATCHSIZE, 100).
|
||||
count_records(Tab, MatchExpression) ->
|
||||
%% the result contains the atom a for each match: We do not need
|
||||
%% the result contains list of [] for each match: We do not need
|
||||
%% actual values as we only count the data.
|
||||
case mnesia:select(Tab, [{MatchExpression, [], [a]}], ?BATCHSIZE, read) of
|
||||
case mnesia:select(Tab, [{MatchExpression, [], [[]]}], ?BATCHSIZE, read) of
|
||||
{Result,Cont} ->
|
||||
Count = length(Result),
|
||||
count_records_cont(Cont, Count);
|
||||
|
Loading…
Reference in New Issue
Block a user