Add try/catch on breakouts methods
This commit is contained in:
parent
2b21a75007
commit
8bd9d056f2
@ -10,13 +10,14 @@ export default function createBreakoutRoom(rooms, durationInMinutes, record = fa
|
||||
const BREAKOUT_LIM = Meteor.settings.public.app.breakouts.breakoutRoomLimit;
|
||||
const MIN_BREAKOUT_ROOMS = 2;
|
||||
const MAX_BREAKOUT_ROOMS = BREAKOUT_LIM > MIN_BREAKOUT_ROOMS ? BREAKOUT_LIM : MIN_BREAKOUT_ROOMS;
|
||||
const EVENT_NAME = 'CreateBreakoutRoomsCmdMsg';
|
||||
|
||||
try {
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
|
||||
const eventName = 'CreateBreakoutRoomsCmdMsg';
|
||||
if (rooms.length > MAX_BREAKOUT_ROOMS) {
|
||||
Logger.info(`Attempt to create breakout rooms with invalid number of rooms in meeting id=${meetingId}`);
|
||||
return;
|
||||
@ -28,5 +29,8 @@ export default function createBreakoutRoom(rooms, durationInMinutes, record = fa
|
||||
meetingId,
|
||||
};
|
||||
|
||||
return RedisPubSub.publishUserMessage(CHANNEL, eventName, meetingId, requesterUserId, payload);
|
||||
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
||||
} catch (err) {
|
||||
Logger.error(`Exception while invoking method createBreakoutRoom ${err.stack}`);
|
||||
}
|
||||
}
|
||||
|
@ -2,16 +2,21 @@ import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
|
||||
export default function endAllBreakouts() {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'EndAllBreakoutRoomsMsg';
|
||||
|
||||
try {
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
|
||||
const eventName = 'EndAllBreakoutRoomsMsg';
|
||||
return RedisPubSub.publishUserMessage(CHANNEL, eventName, meetingId, requesterUserId, null);
|
||||
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, null);
|
||||
} catch (err) {
|
||||
Logger.error(`Exception while invoking method endAllBreakouts ${err.stack}`);
|
||||
}
|
||||
}
|
||||
|
@ -2,25 +2,30 @@ import { Meteor } from 'meteor/meteor';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
|
||||
export default function requestJoinURL({ breakoutId, userId: userIdToInvite }) {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'RequestBreakoutJoinURLReqMsg';
|
||||
|
||||
try {
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
|
||||
const userId = userIdToInvite || requesterUserId;
|
||||
const eventName = 'RequestBreakoutJoinURLReqMsg';
|
||||
|
||||
return RedisPubSub.publishUserMessage(
|
||||
CHANNEL, eventName, meetingId, requesterUserId,
|
||||
CHANNEL, EVENT_NAME, meetingId, requesterUserId,
|
||||
{
|
||||
meetingId,
|
||||
breakoutId,
|
||||
userId,
|
||||
},
|
||||
);
|
||||
} catch (err) {
|
||||
Logger.error(`Exception while invoking method requestJoinURL ${err.stack}`);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user