lets try this

This commit is contained in:
Ashley 2023-10-21 05:14:20 +00:00
parent 2c52963c84
commit bfbf1fc795

View file

@ -49,7 +49,7 @@ const { fetch } = await import("undici");
try { try {
// Set a timeout of 2 seconds. // Set a timeout of 2 seconds.
const timeoutMilliseconds = 2000; // 2 seconds const timeoutMilliseconds = 2000; // 2 seconds
var engagementP = await fetch(apiUrl, { timeout: timeoutMilliseconds }) var engagementP = await fetch(fallbackUrl, { timeout: timeoutMilliseconds })
.then((res) => { .then((res) => {
if (res.statusCode === 504) { if (res.statusCode === 504) {
throw new Error("Request timed out."); throw new Error("Request timed out.");
@ -64,7 +64,7 @@ try {
} }
} catch (error) { } catch (error) {
console.error(error); console.error(error);
var engagement = await fetch(fallbackUrl).then((res) => res.json()); var engagement = await fetch(apiUrl).then((res) => res.json());
return engagement; return engagement;
} }