forked from engineering/cloudservices
fix memory checking issue
parent
344926c742
commit
4ca2e9b188
|
@ -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();
|
||||||
|
|
Loading…
Reference in New Issue