diff --git a/app/api/proxy/route.ts b/app/api/proxy/route.ts index 8dfacf7..d6b1ac8 100644 --- a/app/api/proxy/route.ts +++ b/app/api/proxy/route.ts @@ -39,8 +39,8 @@ export async function GET(request: NextRequest) { if (response.status === 503 && attempt < MAX_RETRIES) { console.warn(`⚠ Got 503 on attempt ${attempt}, retrying... (${url})`); lastError = `503 on attempt ${attempt}`; - // Wait 500ms before retry - await new Promise(resolve => setTimeout(resolve, 500)); + // Wait 100ms before retry + await new Promise(resolve => setTimeout(resolve, 100)); continue; } @@ -52,7 +52,7 @@ export async function GET(request: NextRequest) { lastError = fetchError; if (attempt < MAX_RETRIES) { console.warn(`⚠ Fetch error on attempt ${attempt}, retrying...`, fetchError); - await new Promise(resolve => setTimeout(resolve, 500)); + await new Promise(resolve => setTimeout(resolve, 100)); } else { throw fetchError; } diff --git a/components/search/SearchBox.tsx b/components/search/SearchBox.tsx index 699d32f..89e898a 100644 --- a/components/search/SearchBox.tsx +++ b/components/search/SearchBox.tsx @@ -33,9 +33,7 @@ export function SearchBox({ onSearch, onClear, initialQuery = '' }: SearchBoxPro setQuery(selectedQuery); onSearch(selectedQuery); // Blur the input after selecting from history - setTimeout(() => { - inputRef.current?.blur(); - }, 100); + inputRef.current?.blur(); }); // Update query when initialQuery changes diff --git a/lib/api/http-utils.ts b/lib/api/http-utils.ts index 26f3db2..62ffc42 100644 --- a/lib/api/http-utils.ts +++ b/lib/api/http-utils.ts @@ -5,7 +5,7 @@ const REQUEST_TIMEOUT = 15000; const MAX_RETRIES = 3; -const RETRY_DELAY = 1000; +const RETRY_DELAY = 200; /** * Fetch with timeout support diff --git a/lib/hooks/useHomePage.ts b/lib/hooks/useHomePage.ts index 95f0a5e..2769a55 100644 --- a/lib/hooks/useHomePage.ts +++ b/lib/hooks/useHomePage.ts @@ -66,7 +66,7 @@ export function useHomePage() { setHasSearched(true); loadCachedResults(cached.results, cached.availableSources); } else { - setTimeout(() => handleSearch(urlQuery), 100); + handleSearch(urlQuery); } } }, [searchParams, loadFromCache, loadCachedResults]);