2020-06-04 00:29:44 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
import VideoStreams from '/imports/api/video-streams';
|
|
|
|
|
|
|
|
export default function clearVideoStreams(meetingId) {
|
|
|
|
if (meetingId) {
|
2020-11-25 04:44:13 +08:00
|
|
|
try {
|
|
|
|
const numberAffected = VideoStreams.remove({ meetingId });
|
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Cleared VideoStreams in (${meetingId})`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
2020-12-02 04:02:50 +08:00
|
|
|
Logger.error(`Error on clearing VideoStreams (${meetingId}). ${err}`);
|
2020-11-25 04:44:13 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
try {
|
|
|
|
const numberAffected = VideoStreams.remove({});
|
2020-06-04 00:29:44 +08:00
|
|
|
|
2020-11-25 04:44:13 +08:00
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info('Cleared VideoStreams in all meetings');
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Error on clearing VideoStreams (all). ${err}`);
|
|
|
|
}
|
|
|
|
}
|
2020-06-04 00:29:44 +08:00
|
|
|
}
|