fix memory checking issue
parent
0b08700140
commit
2cec8a45ae
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable no-continue */
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import { Client } from '..';
|
||||
import { RichEmbed } from '../class';
|
||||
|
@ -17,17 +18,12 @@ export default function memory(client: Client) {
|
|||
setInterval(async () => {
|
||||
try {
|
||||
const accounts = await client.db.Account.find();
|
||||
console.log(accounts);
|
||||
for (const acc of accounts) {
|
||||
console.log(acc.username);
|
||||
console.log(acc.root);
|
||||
if (acc.root === true) return;
|
||||
if (acc.root === true) continue;
|
||||
// memory in bytes
|
||||
const mem = Number(await client.util.exec(`memory ${acc.username}`)) * 1000;
|
||||
console.log(mem);
|
||||
// memory in megabytes
|
||||
const memoryConversion = mem / 1024 / 1024;
|
||||
console.log(memoryConversion);
|
||||
let userLimits: { soft: number, hard: number };
|
||||
if (acc.tier === 1) {
|
||||
userLimits = { soft: memoryLimits.TIER_1_SOFT, hard: memoryLimits.TIER_1_HARD };
|
||||
|
@ -40,7 +36,6 @@ export default function memory(client: Client) {
|
|||
/* if the user has exceeded their soft memory limit, which is the one described in the
|
||||
resource limit guidelines, we'll inform staff.
|
||||
*/
|
||||
console.log(memoryConversion, userLimits.soft, userLimits.hard);
|
||||
if (memoryConversion >= userLimits.soft) {
|
||||
client.signale.info(`RAM Soft Limit Reached | ${acc.username} | ${memoryConversion}/${userLimits.soft} MB`);
|
||||
const embed = new RichEmbed();
|
||||
|
|
Loading…
Reference in New Issue