fix(breakout-rooms) fix broadcast timer

This commit is contained in:
Saúl Ibarra Corretgé 2022-09-01 16:55:12 +02:00 committed by Saúl Ibarra Corretgé
parent 8b4f2495dc
commit cfb1fef162
1 changed files with 3 additions and 6 deletions

View File

@ -116,22 +116,19 @@ end
function broadcast_breakout_rooms(room_jid)
local main_room = get_main_room(room_jid);
if not main_room or main_room._data.is_broadcast_breakout_scheduled then
if not main_room or main_room.broadcast_timer then
return;
end
-- Only send each BROADCAST_ROOMS_INTERVAL seconds to prevent flooding of messages.
main_room._data.is_broadcast_breakout_scheduled = true;
main_room:save(true);
module:add_timer(BROADCAST_ROOMS_INTERVAL, function()
main_room.broadcast_timer = module:add_timer(BROADCAST_ROOMS_INTERVAL, function()
local main_room, main_room_jid = get_main_room(room_jid);
if not main_room then
return;
end
main_room._data.is_broadcast_breakout_scheduled = false;
main_room:save(true);
main_room.broadcast_timer = nil;
local real_jid = internal_room_jid_match_rewrite(main_room_jid);
local real_node = jid_node(real_jid);