fix(phisherman): fix caught errors still throwing in getPhishermanDomainInfo()

This commit is contained in:
Dragory 2021-11-03 16:49:27 +02:00
parent fb44a6558f
commit fe7872888b
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -147,7 +147,7 @@ export async function getPhishermanDomainInfo(domain: string): Promise<Phisherma
return pendingDomainInfoChecks.get(domain)!; return pendingDomainInfoChecks.get(domain)!;
} }
const promise = (async () => { let promise = (async () => {
if (memoryCache.has(domain)) { if (memoryCache.has(domain)) {
return memoryCache.get(domain)!.info; return memoryCache.get(domain)!.info;
} }
@ -181,7 +181,7 @@ export async function getPhishermanDomainInfo(domain: string): Promise<Phisherma
return freshData; return freshData;
})(); })();
promise.finally(() => { promise = promise.finally(() => {
pendingDomainInfoChecks.delete(domain); pendingDomainInfoChecks.delete(domain);
}); });
pendingDomainInfoChecks.set(domain, promise); pendingDomainInfoChecks.set(domain, promise);