fix: typeof number check and more safety
This commit is contained in:
1 parent
be20fb0dbb
commit
f6e460d97a
1 file changed
+1
-1
@@ -257,7 +257,7 @@ class NotificationService {
|
|||||||
const alerts = {
|
const alerts = {
|
||||||
cpu: cpuThreshold !== -1 && cpuUsage > cpuThreshold ? true : false,
|
cpu: cpuThreshold !== -1 && cpuUsage > cpuThreshold ? true : false,
|
||||||
memory: memoryThreshold !== -1 && memoryUsage > memoryThreshold ? true : false,
|
memory: memoryThreshold !== -1 && memoryUsage > memoryThreshold ? true : false,
|
||||||
disk: disk?.some(d => diskThreshold !== -1 && d.usage_percent > diskThreshold) ?? false,
|
disk: disk?.some(d => diskThreshold !== -1 && typeof d?.usage_percent === "number" && d?.usage_percent > diskThreshold) ?? false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const notifications = await this.db.getNotificationsByMonitorId(
|
const notifications = await this.db.getNotificationsByMonitorId(
|
||||||
|
|||||||
Reference in new issue
Block a user