bigbluebutton-Github/bigbluebutton-html5/imports/api/voice-users/server/modifiers/clearVoiceUsers.js

27 lines
738 B
JavaScript
Raw Normal View History

2017-08-01 23:00:07 +08:00
import Logger from '/imports/startup/server/logger';
import VoiceUsers from '/imports/api/voice-users';
2017-08-01 23:00:07 +08:00
export default async function clearVoiceUser(meetingId) {
2017-08-01 23:00:07 +08:00
if (meetingId) {
try {
const numberAffected = await VoiceUsers.removeAsync({ meetingId });
if (numberAffected) {
Logger.info(`Cleared VoiceUsers in (${meetingId})`);
}
} catch (err) {
Logger.error(`Error on clearing VoiceUsers in ${meetingId}. ${err}`);
}
} else {
try {
const numberAffected = await VoiceUsers.removeAsync({});
if (numberAffected) {
Logger.info('Cleared VoiceUsers in all meetings');
}
} catch (err) {
Logger.error(`Error on clearing VoiceUsers. ${err}`);
}
}
2017-08-01 23:00:07 +08:00
}