forked from engineering/cloudservices
fix memory checking issue
parent
f38bf25872
commit
2b8772dbfb
|
@ -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.');
|
||||||
|
|
Loading…
Reference in New Issue