25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-07 14:58:56 +02:00

* src/mod_private.erl: Reduce memory consumption on user private storage removal (EJAB-299).

SVN Revision: 852
This commit is contained in:
Mickaël Rémond 2007-08-01 09:36:30 +00:00
parent 442dd0667b
commit a1481f27aa
2 changed files with 15 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2007-08-01 Mickael Remond <mickael.remond@process-one.net>
* src/mod_private.erl: Reduce memory consumption on user private
storage removal (EJAB-299).
2007-07-31 Mickael Remond <mickael.remond@process-one.net>
* src/xml.erl: Making use of CDATA escaping optional through with

View File

@ -107,21 +107,21 @@ get_data(LUser, LServer, [El | Els], Res) ->
get_data(LUser, LServer, Els, Res)
end.
% TODO: use mnesia:select
remove_user(User, Server) ->
LUser = jlib:nodeprep(User),
LServer = jlib:nameprep(Server),
F = fun() ->
Namespaces = mnesia:select(
private_storage,
[{#private_storage{usns={LUser, LServer, '$1'},
_ = '_'},
[],
['$$']}]),
lists:foreach(
fun({U, S, _} = Key) ->
if
(U == LUser) and (S == LServer) ->
mnesia:delete({private_storage, Key});
true ->
ok
end
end, mnesia:all_keys(private_storage))
fun([Namespace]) ->
mnesia:delete({private_storage,
{LUser, LServer, Namespace}})
end, Namespaces)
end,
mnesia:transaction(F).