Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adds detection of occupants with no connection. #14146

Merged
merged 2 commits into from
Dec 12, 2023

Conversation

damencho
Copy link
Member

We saw recently two occasions with rooms with participants but no prosody.full_sessions for those participants and when everyone leaves the meeting it never ends.

We saw recently two occasions with rooms with participants but no prosody.full_sessions for those participants and when everyone leaves the meeting it never ends.
@damencho damencho force-pushed the leak-room-detection branch from b6e7996 to 534a64c Compare December 12, 2023 17:40
@@ -37,6 +37,8 @@ local tostring = tostring;
-- required parameter for custom muc component prefix, defaults to "conference"
local muc_domain_prefix = module:get_option_string("muc_mapper_domain_prefix", "conference");

local leaked_rooms_since_last_stat = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
local leaked_rooms_since_last_stat = 0;
local leaked_rooms = 0;

@@ -49,15 +51,33 @@ function handle_get_room_census(event)
for room in host_session.modules.muc.each_room() do
if not is_healthcheck_room(room.jid) then
local occupants = room._occupants;
local participant_count = 0;
local missing_connections_count = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
local missing_connections_count = 0;
local missing_connections_count = 0;
local current_leaked_rooms = 0;

local leaked = false;
if participant_count > 0 and missing_connections_count == participant_count then
leaked = true;
leaked_rooms_since_last_stat = leaked_rooms_since_last_stat + 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
leaked_rooms_since_last_stat = leaked_rooms_since_last_stat + 1;
current_leaked_rooms = current_leaked_rooms + 1;

leaked = true;
leaked_rooms_since_last_stat = leaked_rooms_since_last_stat + 1;
end

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
leaked_rooms = current_leaked_rooms

-- we calculate the stats on the configured interval (60 seconds by default)
local measure_leaked_rooms = module:measure('leaked_rooms', 'amount');
module:hook_global('stats-update', function ()
measure_leaked_rooms(leaked_rooms_since_last_stat);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
measure_leaked_rooms(leaked_rooms_since_last_stat);
measure_leaked_rooms(leaked_rooms);

local measure_leaked_rooms = module:measure('leaked_rooms', 'amount');
module:hook_global('stats-update', function ()
measure_leaked_rooms(leaked_rooms_since_last_stat);
leaked_rooms_since_last_stat = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
leaked_rooms_since_last_stat = 0;

@damencho damencho merged commit f7995b3 into master Dec 12, 2023
7 of 8 checks passed
@damencho damencho deleted the leak-room-detection branch December 12, 2023 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants