Skip to content

Commit

Permalink
Added timeout for fetch in header
Browse files Browse the repository at this point in the history
  • Loading branch information
xKhronoz committed Jan 26, 2024
1 parent afc8144 commit 7873c88
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion frontend/app/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ export default function Header() {
const { data: apiStatus, error: apiError } = useSWR(healthcheck_api, async (url) => {
try {
// Fetch the data
const response = await fetch(url);
const response = await fetch(url, {
signal: AbortSignal.timeout(5000), // Abort the request if it takes longer than 5 seconds
});
if (!response.ok) {
throw new Error(response.statusText || 'Unknown Error');
}
Expand Down

0 comments on commit 7873c88

Please sign in to comment.