Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(breakout-rooms): Stop previous leave timers if any. (#11842)

Дамян Минковd981acb94ab4
diff --git a/resources/prosody-plugins/mod_muc_breakout_rooms.lua b/resources/prosody-plugins/mod_muc_breakout_rooms.lua
index c6debdd229..103d712e8b 100644
--- a/resources/prosody-plugins/mod_muc_breakout_rooms.lua
+++ b/resources/prosody-plugins/mod_muc_breakout_rooms.lua
@@ -345,9 +345,9 @@ function on_occupant_joined(event)
end
-- Prevent closing all rooms if a participant has joined (see on_occupant_left).
- if main_room._data.is_close_all_scheduled then
- main_room._data.is_close_all_scheduled = false;
- main_room:save();
+ if main_room.close_timer then
+ main_room.close_timer:stop();
+ main_room.close_timer = nil;
end
end
end
@@ -397,19 +397,17 @@ function on_occupant_left(event)
end
-- Close the conference if all left for good.
- if main_room._data.breakout_rooms_active and not main_room._data.is_close_all_scheduled and not exist_occupants_in_rooms(main_room) then
- main_room._data.is_close_all_scheduled = true;
- main_room:save(true);
- module:add_timer(ROOMS_TTL_IF_ALL_LEFT, function()
+ if main_room._data.breakout_rooms_active and not main_room.close_timer and not exist_occupants_in_rooms(main_room) then
+ main_room.close_timer = module:add_timer(ROOMS_TTL_IF_ALL_LEFT, function()
-- we need to look up again the room as till the timer is fired, the room maybe already destroyed/recreated
-- and we will have the old instance
local main_room, main_room_jid = get_main_room(room_jid);
- if main_room and main_room._data.is_close_all_scheduled then
+ if main_room and main_room.close_timer then
module:log('info', 'Closing conference %s as all left for good.', main_room_jid);
main_room:set_persistent(false);
main_room:destroy(nil, 'All occupants left.');
end
- end)
+ end);
end
end