1
0
Fork 0

fix memory checking issue

refactor/models
Matthew 2020-03-29 05:22:22 -04:00
parent f38bf25872
commit 2b8772dbfb
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
1 changed files with 3 additions and 1 deletions

View File

@ -34,7 +34,8 @@ 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.
*/ */
if (acc.tier === 1 && memoryConversion >= userLimits.soft) { if (memoryConversion >= userLimits.soft) {
client.signale.info(`RAM Soft Limit Reached | ${acc.username} | ${memoryConversion}/${userLimits.soft} MB`);
const embed = new RichEmbed(); const embed = new RichEmbed();
if (client.users.get(acc.userID)) embed.setThumbnail(client.users.get(acc.userID).avatarURL); if (client.users.get(acc.userID)) embed.setThumbnail(client.users.get(acc.userID).avatarURL);
embed.addField('User', `${acc.username} | <@${acc.userID}> | ${acc.userID}`, true); embed.addField('User', `${acc.username} | <@${acc.userID}> | ${acc.userID}`, true);
@ -46,6 +47,7 @@ export default function memory(client: Client) {
// if they exceed the hard limit, we'll kill all of their processes. // if they exceed the hard limit, we'll kill all of their processes.
if (memoryConversion >= userLimits.hard) { if (memoryConversion >= userLimits.hard) {
client.signale.info(`RAM Hard Limit Reached | ${acc.username} | ${memoryConversion}/${userLimits.hard} MB`);
client.util.exec(`killall -9 -u ${acc.username}`); client.util.exec(`killall -9 -u ${acc.username}`);
embed.setTitle('Resource Enforcement Notification'); embed.setTitle('Resource Enforcement Notification');
embed.setDescription('Someone has reached the (hard) resource limit for their tier on RAM. The system has automatically killed all of their processes.'); embed.setDescription('Someone has reached the (hard) resource limit for their tier on RAM. The system has automatically killed all of their processes.');