*Ensure the dns module is ready before making a query

This commit is contained in:
Derrick Hammer 2022-08-22 00:35:01 -04:00
parent 512b85aa55
commit ffe6c9595e
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,8 @@
import NodeCache from "node-cache"; import NodeCache from "node-cache";
import { resolve as resolveDns } from "@lumeweb/kernel-dns-client"; import {
ready as dnsReady,
resolve as resolveDns,
} from "@lumeweb/kernel-dns-client";
import { import {
DNS_RECORD_TYPE, DNS_RECORD_TYPE,
DNSRecord, DNSRecord,
@ -24,6 +27,8 @@ export async function resolve(
return cache.get(cacheId) as DNSResult; return cache.get(cacheId) as DNSResult;
} }
await dnsReady();
let res; let res;
try { try {
res = await resolveDns(domain, options, bypassCache); res = await resolveDns(domain, options, bypassCache);