* Refactor DNS module to use deferred promise for setup in present tense.
This commit is contained in:
parent
3b559efabc
commit
97584ee172
|
@ -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 {
|
||||||
|
|
Reference in New Issue