*Refactor to start the dns up only after the ssl and server instances are ready so we don't announce ourselves on the registry pre-maturely

This commit is contained in:
Derrick Hammer 2022-07-23 02:48:02 -04:00
parent 8d7db21184
commit a4ddcdf518
2 changed files with 3 additions and 2 deletions

View File

@ -1,8 +1,6 @@
import { start as startDns } from "./dns.js";
import { start as startRpc } from "./rpc.js"; import { start as startRpc } from "./rpc.js";
import { start as startRelay } from "./relay.js"; import { start as startRelay } from "./relay.js";
await startDns();
await startRpc(); await startRpc();
await startRelay(); await startRelay();

View File

@ -7,6 +7,7 @@ import NodeCache from "node-cache";
import { get as getDHT } from "./dht.js"; import { get as getDHT } from "./dht.js";
import { rpcMethods } from "./rpc/index.js"; import { rpcMethods } from "./rpc/index.js";
import PocketPKG from "@pokt-network/pocket-js"; import PocketPKG from "@pokt-network/pocket-js";
import { start as startDns } from "./dns.js";
const { Configuration, HttpRpcProvider, PocketAAT, Pocket } = PocketPKG; const { Configuration, HttpRpcProvider, PocketAAT, Pocket } = PocketPKG;
import { import {
@ -245,6 +246,8 @@ export async function start() {
jsonServer = new jayson.Server(rpcMethods, { useContext: true }); jsonServer = new jayson.Server(rpcMethods, { useContext: true });
(await getDHT("server")).on("connection", RPCConnection.handleRequest); (await getDHT("server")).on("connection", RPCConnection.handleRequest);
await startDns();
} }
class RPCConnection { class RPCConnection {