1
0
Fork 0

fix memory checking issue

refactor/models
Matthew 2020-03-29 05:53:15 -04:00
parent 6ebddbf9e0
commit c5ddad81c7
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
1 changed files with 17 additions and 8 deletions

View File

@ -25,13 +25,22 @@ export default function memory(client: Client) {
// memory in megabytes // memory in megabytes
const memoryConversion = mem / 1024 / 1024; const memoryConversion = mem / 1024 / 1024;
console.log(memoryLimits); console.log(memoryLimits);
let userLimits: { soft: number, hard: number }; const userLimits: { soft?: number, hard?: number } = {};
if (acc.tier === 1) { switch (acc.tier) {
userLimits = { soft: memoryLimits.TIER_1_SOFT, hard: memoryLimits.TIER_1_HARD }; case 1:
} else if (acc.tier === 2) { userLimits.soft = memoryLimits.TIER_1_SOFT;
userLimits = { soft: memoryLimits.TIER_2_SOFT, hard: memoryLimits.TIER_2_HARD }; userLimits.hard = memoryLimits.TIER_1_HARD;
} else if (acc.tier === 3) { break;
userLimits = { soft: memoryLimits.TIER_3_SOFT, hard: memoryLimits.TIER_3_HARD }; case 2:
userLimits.soft = memoryLimits.TIER_2_SOFT;
userLimits.hard = memoryLimits.TIER_2_HARD;
break;
case 3:
userLimits.soft = memoryLimits.TIER_3_SOFT;
userLimits.hard = memoryLimits.TIER_3_HARD;
break;
default:
break;
} }
console.log(userLimits); console.log(userLimits);
@ -80,5 +89,5 @@ export default function memory(client: Client) {
} catch (err) { } catch (err) {
client.util.handleError(err); client.util.handleError(err);
} }
}, 30000); }, 60000);
} }