This commit is contained in:
Acid Chicken (硫酸鶏) 2018-12-02 13:46:42 +09:00 committed by GitHub
parent a12e8ccb15
commit 675b4ea85a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,7 +38,7 @@ export default class ServerModule implements IModule {
private check = () => {
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);
if (cpuPercentage >= 70) {
this.warn();