fix(awooop): keep work items telemetry from blocking
All checks were successful
Code Review / ai-code-review (push) Successful in 9s
CD Pipeline / tests (push) Successful in 1m3s
CD Pipeline / build-and-deploy (push) Successful in 3m21s
CD Pipeline / post-deploy-checks (push) Successful in 1m28s

This commit is contained in:
Your Name
2026-05-14 21:56:42 +08:00
parent 224ae9e202
commit 44f7471b21

View File

@@ -98,13 +98,20 @@ const statusConfig: Record<WorkStatus, { className: string; icon: typeof Activit
},
};
async function fetchJson<T>(url: string): Promise<T | null> {
async function fetchJson<T>(url: string, timeoutMs = 8000): Promise<T | null> {
const controller = new AbortController();
const timeout = window.setTimeout(() => controller.abort(), timeoutMs);
try {
const response = await fetch(url, { cache: "no-store" });
const response = await fetch(url, {
cache: "no-store",
signal: controller.signal,
});
if (!response.ok) return null;
return (await response.json()) as T;
} catch {
return null;
} finally {
window.clearTimeout(timeout);
}
}