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) {
try {
console.log(`[Discord Bot Health] Trying ${url}...`);
response = await fetch(url, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
timeout: 5000,
});
// Create AbortController with 5 second timeout for internal Railway, 3 seconds for localhost
const isInternal = url.includes("railway.internal");
const timeoutMs = isInternal ? 5000 : 3000;
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
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 responseBody = await response.text();