forked from engineering/cloudservices
fix memory checking issue
parent
4ca2e9b188
commit
271cfe1959
|
@ -15,15 +15,18 @@ export const memoryLimits = {
|
||||||
|
|
||||||
export default function memory(client: Client) {
|
export default function memory(client: Client) {
|
||||||
setInterval(async () => {
|
setInterval(async () => {
|
||||||
|
try {
|
||||||
const accounts = await client.db.Account.find();
|
const accounts = await client.db.Account.find();
|
||||||
console.log(accounts);
|
console.log(accounts);
|
||||||
for (const acc of accounts) {
|
for (const acc of accounts) {
|
||||||
console.log(acc);
|
console.log(acc);
|
||||||
if (acc.root) return;
|
if (acc.root === true) 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;
|
||||||
|
console.log(mem);
|
||||||
// memory in megabytes
|
// memory in megabytes
|
||||||
const memoryConversion = mem / 1024 / 1024;
|
const memoryConversion = mem / 1024 / 1024;
|
||||||
|
console.log(memoryConversion);
|
||||||
let userLimits: { soft: number, hard: number };
|
let userLimits: { soft: number, hard: number };
|
||||||
if (acc.tier === 1) {
|
if (acc.tier === 1) {
|
||||||
userLimits = { soft: memoryLimits.TIER_1_SOFT, hard: memoryLimits.TIER_1_HARD };
|
userLimits = { soft: memoryLimits.TIER_1_SOFT, hard: memoryLimits.TIER_1_HARD };
|
||||||
|
@ -76,5 +79,8 @@ export default function memory(client: Client) {
|
||||||
client.createMessage(channelID, { embed });
|
client.createMessage(channelID, { embed });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
client.util.handleError(err);
|
||||||
|
}
|
||||||
}, 60000);
|
}, 60000);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue