mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
Make decide room better handle rooms that were just hibernated
This commit is contained in:
parent
e937ff62fe
commit
0fe64674ee
@ -874,12 +874,23 @@ decide_rooms(Method, Rooms, Last_allowed) ->
|
|||||||
decide_room(unused, {_Room_name, _Host, _ServerHost, Room_pid}, Last_allowed) ->
|
decide_room(unused, {_Room_name, _Host, _ServerHost, Room_pid}, Last_allowed) ->
|
||||||
NodeStartTime = erlang:system_time(microsecond) -
|
NodeStartTime = erlang:system_time(microsecond) -
|
||||||
1000000*(erlang:monotonic_time(second)-ejabberd_config:get_node_start()),
|
1000000*(erlang:monotonic_time(second)-ejabberd_config:get_node_start()),
|
||||||
|
OnlyHibernated = case mod_muc_opt:hibernation_timeout(ServerHost) of
|
||||||
|
Value when Value < Last_allowed*24*60*60*1000 ->
|
||||||
|
true;
|
||||||
|
_ ->
|
||||||
|
false
|
||||||
|
end,
|
||||||
{Just_created, Num_users} =
|
{Just_created, Num_users} =
|
||||||
case Room_pid of
|
case Room_pid of
|
||||||
|
Pid when is_pid(Pid) andalso OnlyHibernated ->
|
||||||
|
{0, 0};
|
||||||
Pid when is_pid(Pid) ->
|
Pid when is_pid(Pid) ->
|
||||||
S = get_room_state(Room_pid),
|
case mod_muc_room:get_state(Room_pid) of
|
||||||
{S#state.just_created,
|
#state{just_created = JD, users = U} ->
|
||||||
maps:size(S#state.users)};
|
{JD, maps:size(U)};
|
||||||
|
_ ->
|
||||||
|
{0, 0}
|
||||||
|
end;
|
||||||
Opts ->
|
Opts ->
|
||||||
case lists:keyfind(hibernation_time, 1, Opts) of
|
case lists:keyfind(hibernation_time, 1, Opts) of
|
||||||
false ->
|
false ->
|
||||||
|
Loading…
Reference in New Issue
Block a user