Merge pull request #350 from hydroflame/fix-server-used-ram

fixed ramUsed wrong calculation
This commit is contained in:
danielyxie 2018-07-06 17:06:46 -05:00 committed by GitHub
commit e0ef2eae7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -164,8 +164,17 @@ function runScriptsLoop() {
var ip = workerScripts[i].serverIp; var ip = workerScripts[i].serverIp;
var name = workerScripts[i].name; var name = workerScripts[i].name;
//Free RAM //recalculate ram used
AllServers[ip].ramUsed -= workerScripts[i].ramUsage; AllServers[ip].ramUsed = 0;
for(let j = 0; j < workerScripts.length; j++) {
if(workerScripts[j].serverIp !== ip) {
continue
}
if(j === i) { // not this one
continue
}
AllServers[ip].ramUsed += workerScripts[j].ramUsage;
}
//Delete script from Active Scripts //Delete script from Active Scripts
deleteActiveScriptsItem(workerScripts[i]); deleteActiveScriptsItem(workerScripts[i]);