* Refactor DNS module to use deferred promise for setup in present tense.

This commit is contained in:
Derrick Hammer 2023-04-09 19:43:56 -04:00
parent 3b559efabc
commit 97584ee172
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 4 deletions

View File

@ -4,9 +4,8 @@ import {
DNSResult,
ResolverOptions,
} from "@lumeweb/libresolver";
import { blake2b, bufToHex, Err } from "libskynet/dist";
import { getDnsSetupPromise } from "./main/vars.js";
import { createClient, DnsClient } from "@lumeweb/kernel-dns-client";
import { blake2b, bufToHex } from "libskynet/dist";
import { getDnsSetupDefer } from "./main/vars.js";
import { dnsClient } from "./clients.js";
const cache = new NodeCache({ stdTTL: 60 });
@ -25,7 +24,7 @@ export async function resolve(
return cache.get(cacheId) as DNSResult;
}
await getDnsSetupPromise();
await getDnsSetupDefer().promise;
let res;
try {