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