Skip to content

Commit

Permalink
Fix caching issue
Browse files Browse the repository at this point in the history
  • Loading branch information
popeeyy committed Dec 17, 2022
1 parent 7b23b13 commit 6a0581c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/whoiser.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,14 @@ const whoisTld = async (query, { timeout = 15000, raw = false, domainThirdLevel
// Check for 3rd level domain
if (domainThirdLevel) {
let [_, secondTld] = domainName && splitStringBy(domainName, domainName.lastIndexOf('.')) // Parse 3rd level domain
const whois = await whoisTldAlternate(secondTld ? `${secondTld}.${domainTld}` : query) // Query alternate sources
const finalTld = secondTld ? `${secondTld}.${domainTld}` : query

const whois = await whoisTldAlternate(finalTld) // Query alternate sources
if (whois)
return {
refer: whois,
domain: domainName,
finalTld,
whois,
} // Return alternate whois data
}
Expand Down Expand Up @@ -138,7 +141,7 @@ const whoisDomain = async (domain, { host = null, timeout = 15000, follow = 2, r
}

host = tld.whois
cacheTldWhoisServer[domainTld] = tld.whois
cacheTldWhoisServer[tld.finalTld || domainTld] = tld.whois
}

// query WHOIS servers for data
Expand Down

0 comments on commit 6a0581c

Please sign in to comment.