You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
I'm querying domain data using Whoiser but when given a timeout of 5000 it does not respect that and it ends up quering for over 30s
Also if given an invalid URL e.g "hereandthere" it takes forever to return a response for invalid TLD. This is after supplying a 5s timeout
Version(s) affected: "^1.17.3",
Description
I'm querying domain data using Whoiser but when given a timeout of 5000 it does not respect that and it ends up quering for over 30s
Also if given an invalid URL e.g "hereandthere" it takes forever to return a response for invalid TLD. This is after supplying a 5s timeout
How to reproduce
`
interface DomainData {
status: "success" | "error";
data: WhoisSearchResult | null;
message: string;
}
export async function getDomainData(domain: string): Promise {
try {
const domainData = await whoiser(domain, {
timeout: 5000,
});
} catch (error: any) {
console.log("there is an error", error.message);
return {
status: "error",
data: null,
message:
error.message || "An error occured while fetching domain details",
};
}
}
`
And here is the client
`
const [data, setData] = useState<WhoisSearchResult | null>(null);
const [isLoading, setIsLoading] = useState(false);
const toast = useToast();
async function fetchData() {
setIsLoading(true);
const res = await getDomainData("hereandthere");
setIsLoading(false);
if (res.data && res.status === "success") {
setData(res.data);
}
toast({
title: "Error",
description: res.message,
status: res.status,
duration: 9000,
isClosable: true,
});
}
`
loading is indefinate when invalid tlds are supplied for over 30seconds
Possible Solution
maybe fix the timeout to be respected if the request goes over 5 seconds then timeout should work
Additional context
The text was updated successfully, but these errors were encountered: