2020-04-10 01:01:46 +08:00
|
|
|
import ConnectionStatus from '/imports/api/connection-status';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
|
2023-03-10 20:06:13 +08:00
|
|
|
export default async 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 {
|
2023-03-10 20:06:13 +08:00
|
|
|
const numberAffected = await ConnectionStatus.removeAsync(selector);
|
2021-03-26 05:22:50 +08:00
|
|
|
|
|
|
|
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
|
|
|
}
|