2020-04-10 01:01:46 +08:00
|
|
|
import ConnectionStatus from '/imports/api/connection-status';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
|
|
|
|
export default function clearConnectionStatus(meetingId) {
|
2021-03-26 05:22:50 +08:00
|
|
|
const selector = {};
|
|
|
|
|
2020-04-10 01:01:46 +08:00
|
|
|
if (meetingId) {
|
2021-03-26 05:22:50 +08:00
|
|
|
selector.meetingId = meetingId;
|
2020-04-10 01:01:46 +08:00
|
|
|
}
|
|
|
|
|
2021-03-26 05:22:50 +08:00
|
|
|
try {
|
|
|
|
const numberAffected = ConnectionStatus.remove(selector);
|
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
if (meetingId) {
|
|
|
|
Logger.info(`Removed ConnectionStatus (${meetingId})`);
|
|
|
|
} else {
|
|
|
|
Logger.info('Removed ConnectionStatus (all)');
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
Logger.warn('Removing ConnectionStatus nonaffected');
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Removing ConnectionStatus: ${err}`);
|
|
|
|
}
|
2020-04-10 01:01:46 +08:00
|
|
|
}
|