Skip to content

Commit

Permalink
chore: minor network changes
Browse files Browse the repository at this point in the history
  • Loading branch information
d-roak committed Dec 8, 2024
1 parent eb4ab71 commit 8d407a6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/network/src/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class DRPNetworkNode {
];

const _pubsubPeerDiscovery = pubsubPeerDiscovery({
interval: 10_000,
interval: 5_000,
topics: ["drp::discovery"],
});

Expand Down Expand Up @@ -134,7 +134,7 @@ export class DRPNetworkNode {

if (!this._config?.bootstrap) {
for (const addr of this._config?.bootstrap_peers || []) {
this._node.dial(multiaddr(addr));
await this._node.dial(multiaddr(addr));
}
}

Expand All @@ -149,7 +149,7 @@ export class DRPNetworkNode {
this._node.addEventListener("peer:connect", (e) =>
log.info("::start::peer::connect", e.detail),
);
this._node.addEventListener("peer:discovery", (e) => {
this._node.addEventListener("peer:discovery", async (e) => {
// current bug in v11.0.0 requires manual dial (https://github.com/libp2p/js-libp2p-pubsub-peer-discovery/issues/149)
const sortedAddrs = e.detail.multiaddrs.sort((a, b) => {
const localRegex =
Expand All @@ -167,7 +167,7 @@ export class DRPNetworkNode {

// Dial non-local multiaddrs, then WebRTC multiaddrs
for (const address of sortedAddrs) {
this._node?.dial(address);
await this._node?.dial(address);
}

log.info("::start::peer::discovery", e.detail);
Expand Down

0 comments on commit 8d407a6

Please sign in to comment.