fix merge issue

This commit is contained in:
Frank Elsinga 2025-06-28 22:58:30 +02:00 committed by GitHub
parent 6e0f1c46b8
commit 771845c62f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,7 +11,19 @@ class GroupMonitorType extends MonitorType {
async check(monitor, heartbeat, _server) {
const children = await Monitor.getChildren(monitor.id);
if (children.length > 0) {
if (children.length == 0) {
// Set status pending if group is empty
heartbeat.status = PENDING;
heartbeat.msg = "Group empty";
return
}
if (children.filter(child => child.active).length === 0) {
// Set status pending if all children are paused
bean.status = PENDING;
bean.msg = "All Children are paused.";
return
}
heartbeat.status = UP;
heartbeat.msg = "All children up and running";
for (const child of children) {
@ -35,11 +47,6 @@ class GroupMonitorType extends MonitorType {
if (heartbeat.status !== UP) {
heartbeat.msg = "Child inaccessible";
}
} else {
// Set status pending if group is empty
heartbeat.status = PENDING;
heartbeat.msg = "Group empty";
}
}
}