bigbluebutton-Github/bigbluebutton-html5/imports/api/users/server/modifiers/userInactivityInspect.js
2023-03-20 16:35:52 -03:00

31 lines
712 B
JavaScript

import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import Users from '/imports/api/users';
export default async function userInactivityInspect(userId, responseDelay) {
check(userId, String);
check(responseDelay, Match.Integer);
const selector = {
userId,
inactivityCheck: false,
};
const modifier = {
$set: {
inactivityCheck: true,
responseDelay,
},
};
try {
const { numberAffected } = await Users.updateAsync(selector, modifier);
if (numberAffected) {
Logger.info(`Updated user ${userId} with inactivity inspect`);
}
} catch (err) {
Logger.error(`Inactivity check for user ${userId}: ${err}`);
}
}