Commit 37e9b4a9 authored by tom's avatar tom

add timeout to search redirect

parent 144a213a
...@@ -30,7 +30,9 @@ export const getServerSideProps: GetServerSideProps<Props> = async({ req, res, r ...@@ -30,7 +30,9 @@ export const getServerSideProps: GetServerSideProps<Props> = async({ req, res, r
try { try {
const q = String(query.q); const q = String(query.q);
const url = buildUrlNode('search_check_redirect', undefined, { q }); const url = buildUrlNode('search_check_redirect', undefined, { q });
const redirectsResponse = await fetchFactory(req)(url); const redirectsResponse = await fetchFactory(req)(url, {
signal: AbortSignal.timeout(1_000),
});
const payload = await redirectsResponse.json() as SearchRedirectResult; const payload = await redirectsResponse.json() as SearchRedirectResult;
if (!payload || typeof payload !== 'object' || !payload.redirect) { if (!payload || typeof payload !== 'object' || !payload.redirect) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment