diff --git a/services/appsService.js b/services/appsService.js index 71c1c6f8..91a68689 100644 --- a/services/appsService.js +++ b/services/appsService.js @@ -9665,6 +9665,7 @@ async function checkApplicationsCpuUSage() { // cpu was high on 80% of the checks cpuThrottling = true; } + appsMonitored[app.name].lastHourstatsStore = []; log.info(`checkApplicationsCpuUSage ${app.name} cpu high load: ${cpuThrottling}`); log.info(`checkApplicationsCpuUSage ${cpuPercentage}`); if (cpuThrottling && app.cpu > 1) { @@ -9677,28 +9678,23 @@ async function checkApplicationsCpuUSage() { await dockerService.appDockerUpdateCpu(app.name, Math.round(app.cpu * 1e9 * 0.9)); } log.info(`checkApplicationsCpuUSage ${app.name} lowering cpu.`); - appsMonitored[app.name].lastHourstatsStore = []; } } else if (cpuPercentage <= 0.8) { // eslint-disable-next-line no-await-in-loop await dockerService.appDockerUpdateCpu(app.name, Math.round(app.cpu * 1e9 * 0.85)); log.info(`checkApplicationsCpuUSage ${app.name} increasing cpu 85.`); - appsMonitored[app.name].lastHourstatsStore = []; } else if (cpuPercentage <= 0.85) { // eslint-disable-next-line no-await-in-loop await dockerService.appDockerUpdateCpu(app.name, Math.round(app.cpu * 1e9 * 0.9)); log.info(`checkApplicationsCpuUSage ${app.name} increasing cpu 90.`); - appsMonitored[app.name].lastHourstatsStore = []; } else if (cpuPercentage <= 0.9) { // eslint-disable-next-line no-await-in-loop await dockerService.appDockerUpdateCpu(app.name, Math.round(app.cpu * 1e9 * 0.95)); log.info(`checkApplicationsCpuUSage ${app.name} increasing cpu 95.`); - appsMonitored[app.name].lastHourstatsStore = []; } else if (cpuPercentage < 1) { // eslint-disable-next-line no-await-in-loop await dockerService.appDockerUpdateCpu(app.name, Math.round(app.cpu * 1e9)); log.info(`checkApplicationsCpuUSage ${app.name} increasing cpu 100.`); - appsMonitored[app.name].lastHourstatsStore = []; } } } else { @@ -9726,6 +9722,7 @@ async function checkApplicationsCpuUSage() { // cpu was high on 80% of the checks cpuThrottling = true; } + appsMonitored[`${appComponent.name}_${app.name}`].lastHourstatsStore = []; log.info(`checkApplicationsCpuUSage ${appComponent.name}_${app.name} cpu high load: ${cpuThrottling}`); log.info(`checkApplicationsCpuUSage ${cpuPercentage}`); if (cpuThrottling && appComponent.cpu > 1) { @@ -9738,28 +9735,23 @@ async function checkApplicationsCpuUSage() { await dockerService.appDockerUpdateCpu(`${appComponent.name}_${app.name}`, Math.round(appComponent.cpu * 1e9 * 0.9)); } log.info(`checkApplicationsCpuUSage ${appComponent.name}_${app.name} lowering cpu.`); - appsMonitored[app.name].lastHourstatsStore = []; } } else if (cpuPercentage <= 0.8) { // eslint-disable-next-line no-await-in-loop await dockerService.appDockerUpdateCpu(`${appComponent.name}_${app.name}`, Math.round(appComponent.cpu * 1e9 * 0.85)); log.info(`checkApplicationsCpuUSage ${appComponent.name}_${app.name} increasing cpu 85.`); - appsMonitored[`${appComponent.name}_${app.name}`].lastHourstatsStore = []; } else if (cpuPercentage <= 0.85) { // eslint-disable-next-line no-await-in-loop await dockerService.appDockerUpdateCpu(`${appComponent.name}_${app.name}`, Math.round(appComponent.cpu * 1e9 * 0.9)); log.info(`checkApplicationsCpuUSage ${appComponent.name}_${app.name} increasing cpu 90.`); - appsMonitored[`${appComponent.name}_${app.name}`].lastHourstatsStore = []; } else if (cpuPercentage <= 0.9) { // eslint-disable-next-line no-await-in-loop await dockerService.appDockerUpdateCpu(`${appComponent.name}_${app.name}`, Math.round(appComponent.cpu * 1e9 * 0.95)); log.info(`checkApplicationsCpuUSage ${appComponent.name}_${app.name} increasing cpu 95.`); - appsMonitored[`${appComponent.name}_${app.name}`].lastHourstatsStore = []; } else if (cpuPercentage < 1) { // eslint-disable-next-line no-await-in-loop await dockerService.appDockerUpdateCpu(`${appComponent.name}_${app.name}`, Math.round(appComponent.cpu * 1e9)); log.info(`checkApplicationsCpuUSage ${appComponent.name}_${app.name} increasing cpu 100.`); - appsMonitored[`${appComponent.name}_${app.name}`].lastHourstatsStore = []; } } } diff --git a/services/serviceManager.js b/services/serviceManager.js index 0759ea02..30669071 100644 --- a/services/serviceManager.js +++ b/services/serviceManager.js @@ -216,7 +216,7 @@ async function startFluxFunctions() { setInterval(() => { appsService.checkApplicationsCpuUSage(); }, 15 * 60 * 1000); - }, 20 * 60 * 1000); + }, 15 * 60 * 1000); setTimeout(() => { // appsService.checkForNonAllowedAppsOnLocalNetwork(); appsService.checkMyAppsAvailability(); // periodically checks