From 5f770d861d85c1f0915b81f9145e191d8e44ba71 Mon Sep 17 00:00:00 2001 From: thedrewen Date: Thu, 30 Oct 2025 19:55:21 +0100 Subject: [PATCH 1/2] fix(fetch): adjust host filtering logic to use max_ping for improved accuracy --- src/services/status.service.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/services/status.service.ts b/src/services/status.service.ts index cbabe9e..f4116c4 100644 --- a/src/services/status.service.ts +++ b/src/services/status.service.ts @@ -101,7 +101,9 @@ export class StatusService { private async fetch(max = 1): Promise { - const hosts = this.hosts.filter((value, index) => index < max * 10 && index >= (max - 1) * 10); + const max_ping = 3; + + const hosts = this.hosts.filter((value, index) => index < max * max_ping && index >= (max - 1) * max_ping); async function fetchAlive(host: Host) { if(host.type === 'ping'){ let res = await ping.promise.probe(host.host, {timeout: 3}); @@ -121,13 +123,13 @@ export class StatusService { const updatedHosts = await Promise.all(fetchPromises); updatedHosts.forEach((updatedHost, index) => { - const originalIndex = (max - 1) * 10 + index; + const originalIndex = (max - 1) * max_ping + index; if (originalIndex < this.hosts.length) { this.hosts[originalIndex] = updatedHost; } }); - if(this.hosts.length > max * 10) { + if(this.hosts.length > max * max_ping) { await this.fetch(max + 1); } From 3c6fd92cc230515387f738684a49983ade4a091c Mon Sep 17 00:00:00 2001 From: thedrewen Date: Thu, 30 Oct 2025 21:16:43 +0100 Subject: [PATCH 2/2] fix(status): increase ping timeout from 3 to 10 seconds for improved reliability --- src/services/status.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/status.service.ts b/src/services/status.service.ts index f4116c4..cbf32fc 100644 --- a/src/services/status.service.ts +++ b/src/services/status.service.ts @@ -106,7 +106,7 @@ export class StatusService { const hosts = this.hosts.filter((value, index) => index < max * max_ping && index >= (max - 1) * max_ping); async function fetchAlive(host: Host) { if(host.type === 'ping'){ - let res = await ping.promise.probe(host.host, {timeout: 3}); + let res = await ping.promise.probe(host.host, {timeout: 10}); host.alive = res.alive; }else if(host.type === 'website'){ try {