completionId: cgen-93704a3380484bba8ef4331270bf5498

cgen-93704a3380484bba8ef4331270bf5498
This commit is contained in:
Builder.io 2025-11-10 03:02:46 +00:00
parent bdad530914
commit 268092b56d

View file

@ -1703,13 +1703,23 @@ export function createServer() {
for (const url of botHealthUrls) { for (const url of botHealthUrls) {
try { try {
console.log(`[Discord Bot Health] Trying ${url}...`); console.log(`[Discord Bot Health] Trying ${url}...`);
response = await fetch(url, { // Create AbortController with 5 second timeout for internal Railway, 3 seconds for localhost
method: "GET", const isInternal = url.includes("railway.internal");
headers: { const timeoutMs = isInternal ? 5000 : 3000;
"Content-Type": "application/json", const controller = new AbortController();
}, const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
timeout: 5000,
}); try {
response = await fetch(url, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
signal: controller.signal,
});
} finally {
clearTimeout(timeoutId);
}
const contentType = response.headers.get("content-type") || ""; const contentType = response.headers.get("content-type") || "";
const responseBody = await response.text(); const responseBody = await response.text();