fix: fetch timeout for external requests to small (#881)

* fix: fetch timeout for external requests to small

* fix: format issue

* fix: move clear timeout for fetch to finally
This commit is contained in:
Meier Lukas
2024-07-29 06:30:56 +02:00
committed by GitHub
parent 406ed16ce4
commit 67dad45214
9 changed files with 34 additions and 7 deletions

View File

@@ -1,9 +1,9 @@
import { extractErrorMessage } from "@homarr/common";
import { extractErrorMessage, fetchWithTimeout } from "@homarr/common";
import { logger } from "@homarr/log";
export const sendPingRequestAsync = async (url: string) => {
try {
return await fetch(url).then((response) => ({ statusCode: response.status }));
return await fetchWithTimeout(url).then((response) => ({ statusCode: response.status }));
} catch (error) {
logger.error("packages/ping/src/index.ts:", error);
return {