Skip to content

Commit

Permalink
fix: Space out approval of guests to better handle larger groups
Browse files Browse the repository at this point in the history
Space out the group handling of guest accept all.
Handle the groups in batches of up to three.
Dispatch a new batch approval every 500ms (configurable)
  • Loading branch information
antobinary committed Oct 10, 2024
1 parent ff8b3f7 commit efb9105
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,26 @@ import Auth from '/imports/ui/services/auth';
import GuestUsers from '/imports/api/guest-users';
import { makeCall } from '/imports/ui/services/api';

const guestUsersCall = (guestsArray, status) => makeCall('allowPendingUsers', guestsArray, status);
const sizeOfBatches = 3; // commonly deployments have 3-4 or more instances of bbb-html5-frontend
const delayForApprovalOfGuests = Meteor.settings.public.app.delayForApprovalOfGuests || 500;

const breakIntoSmallerGroups = (array) => {
return array
.map((_, index) => {
return index % sizeOfBatches === 0 ? array.slice(index, index + sizeOfBatches) : null;
})
.filter(group => group) // remove null values
.map(group => group.filter(item => item !== undefined)); // remove undefined items
};

async function guestUsersCall(guestsArray, status) {
// Processing large arrays (20+ guests) puts a lot of stress on frontends
// Here we split the approved guests into batches and space out the batch processing
for (const batch of breakIntoSmallerGroups(guestsArray)) {
makeCall('allowPendingUsers', batch, status);
await new Promise(resolve => setTimeout(resolve, delayForApprovalOfGuests));
};
}

const changeGuestPolicy = (policyRule) => makeCall('changeGuestPolicy', policyRule);

Expand Down
1 change: 1 addition & 0 deletions bigbluebutton-html5/private/config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public:
dynamicGuestPolicy: true
enableGuestLobbyMessage: true
guestPolicyExtraAllowOptions: false
delayForApprovalOfGuests: 500
alwaysShowWaitingRoomUI: true
enableLimitOfViewersInWebcam: false
enableMultipleCameras: true
Expand Down

0 comments on commit efb9105

Please sign in to comment.