diff options
author | Paweł Chmielowski <pchmielowski@process-one.net> | 2019-07-16 13:57:48 +0200 |
---|---|---|
committer | Paweł Chmielowski <pchmielowski@process-one.net> | 2019-07-16 15:09:58 +0200 |
commit | 6b3d0d154e96a42ba1f18ad3a445d9f6e9aaccfa (patch) | |
tree | 941d767c01fa655f7c09ba98689b8e08bf6bc81c /src/mod_muc.erl | |
parent | Bump xmpp version and fix revealed bugs (diff) |
Add code for hibernating inactive muc_room processes
Diffstat (limited to 'src/mod_muc.erl')
-rw-r--r-- | src/mod_muc.erl | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mod_muc.erl b/src/mod_muc.erl index 7915b283f..350fe9d39 100644 --- a/src/mod_muc.erl +++ b/src/mod_muc.erl @@ -787,7 +787,16 @@ load_room(RMod, Host, ServerHost, Room) -> ?DEBUG("Restore room: ~s", [Room]), start_room(RMod, Host, ServerHost, Room, Opts0); _ -> - {error, notfound} + ?DEBUG("Restore hibernated non-persistent room: ~s", [Room]), + Res = start_room(RMod, Host, ServerHost, Room, Opts0), + Mod = gen_mod:db_mod(ServerHost, mod_muc), + case erlang:function_exported(Mod, get_subscribed_rooms, 3) of + true -> + ok; + _ -> + forget_room(ServerHost, Host, Room) + end, + Res end end. @@ -1167,7 +1176,9 @@ mod_opt_type(host) -> mod_opt_type(hosts) -> econf:hosts(); mod_opt_type(queue_type) -> - econf:queue_type(). + econf:queue_type(); +mod_opt_type(hibernation_timeout) -> + econf:non_neg_int(infinity). mod_options(Host) -> [{access, all}, @@ -1198,6 +1209,7 @@ mod_options(Host) -> {user_message_shaper, none}, {user_presence_shaper, none}, {preload_rooms, true}, + {hibernation_timeout, infinity}, {default_room_options, [{allow_change_subj,true}, {allow_private_messages,true}, |