25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-26 16:26:24 +01:00

* src/mod_stats.erl: Minor optimizations

SVN Revision: 291
This commit is contained in:
Alexey Shchepin 2004-12-12 22:32:15 +00:00
parent 591bc42669
commit 0e9f506a91
2 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,7 @@
2004-12-12 Alexey Shchepin <alexey@sevcom.net> 2004-12-12 Alexey Shchepin <alexey@sevcom.net>
* src/mod_stats.erl: Minor optimizations
* src/ejabberd_sm.erl: Added unset_presence_hook * src/ejabberd_sm.erl: Added unset_presence_hook
* src/mod_last.erl: Use unset_presence_hook instead of direct call * src/mod_last.erl: Use unset_presence_hook instead of direct call

View File

@ -122,18 +122,18 @@ get_local_stats(_, _) ->
% ?STATVAL(io_lib:format("~.3f", [element(1, statistics(runtime))/1000]), % ?STATVAL(io_lib:format("~.3f", [element(1, statistics(runtime))/1000]),
% "seconds"); % "seconds");
get_local_stat([], Name) when Name == "users/online" -> get_local_stat([], Name) when Name == "users/online" ->
case catch ejabberd_sm:dirty_get_sessions_list() of case catch mnesia:table_info(session, size) of
{'EXIT', Reason} -> {'EXIT', Reason} ->
?STATERR("500", "Internal Server Error"); ?STATERR("500", "Internal Server Error");
Users -> Users ->
?STATVAL(integer_to_list(length(Users)), "users") ?STATVAL(integer_to_list(Users), "users")
end; end;
get_local_stat([], Name) when Name == "users/total" -> get_local_stat([], Name) when Name == "users/total" ->
case catch ejabberd_auth:dirty_get_registered_users() of case catch mnesia:table_info(passwd, size) of
{'EXIT', Reason} -> {'EXIT', Reason} ->
?STATERR("500", "Internal Server Error"); ?STATERR("500", "Internal Server Error");
Users -> Users ->
?STATVAL(integer_to_list(length(Users)), "users") ?STATVAL(integer_to_list(Users), "users")
end; end;
get_local_stat(_, Name) -> get_local_stat(_, Name) ->
?STATERR("404", "Not Found"). ?STATERR("404", "Not Found").