1
0
Fork 0

fix memory checking issue

refactor/models
Matthew 2020-03-29 05:28:40 -04:00
parent 344926c742
commit 4ca2e9b188
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
1 changed files with 3 additions and 0 deletions

View File

@ -16,7 +16,9 @@ export const memoryLimits = {
export default function memory(client: Client) { export default function memory(client: Client) {
setInterval(async () => { setInterval(async () => {
const accounts = await client.db.Account.find(); const accounts = await client.db.Account.find();
console.log(accounts);
for (const acc of accounts) { for (const acc of accounts) {
console.log(acc);
if (acc.root) return; if (acc.root) return;
// memory in bytes // memory in bytes
const mem = Number(await client.util.exec(`memory ${acc.username}`)) * 1000; const mem = Number(await client.util.exec(`memory ${acc.username}`)) * 1000;
@ -34,6 +36,7 @@ export default function memory(client: Client) {
/* if the user has exceeded their soft memory limit, which is the one described in the /* if the user has exceeded their soft memory limit, which is the one described in the
resource limit guidelines, we'll inform staff. resource limit guidelines, we'll inform staff.
*/ */
console.log(memoryConversion, userLimits.soft, userLimits.hard);
if (memoryConversion >= userLimits.soft) { if (memoryConversion >= userLimits.soft) {
client.signale.info(`RAM Soft Limit Reached | ${acc.username} | ${memoryConversion}/${userLimits.soft} MB`); client.signale.info(`RAM Soft Limit Reached | ${acc.username} | ${memoryConversion}/${userLimits.soft} MB`);
const embed = new RichEmbed(); const embed = new RichEmbed();