mirror of
https://github.com/syuilo/ai.git
synced 2024-11-22 05:08:00 +00:00
parent
a12e8ccb15
commit
ce6bd6a7c3
|
@ -38,7 +38,7 @@ export default class ServerModule implements IModule {
|
||||||
private check = () => {
|
private check = () => {
|
||||||
const average = (arr) => arr.reduce((a, b) => a + b) / arr.length;
|
const average = (arr) => arr.reduce((a, b) => a + b) / arr.length;
|
||||||
|
|
||||||
const cpuPercentages = this.statsLogs.map(s => s.cpu_usage * 100);
|
const cpuPercentages = this.statsLogs.map(s => s && s.cpu_usage * 100 || 0);
|
||||||
const cpuPercentage = average(cpuPercentages);
|
const cpuPercentage = average(cpuPercentages);
|
||||||
if (cpuPercentage >= 70) {
|
if (cpuPercentage >= 70) {
|
||||||
this.warn();
|
this.warn();
|
||||||
|
|
Loading…
Reference in a new issue