Skip to content

Commit

Permalink
minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
danisharora099 committed Sep 7, 2023
1 parent 51c91cd commit b132ffe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/core/src/lib/keep_alive_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export class KeepAliveManager {

if (pingPeriodSecs !== 0) {
const interval = setInterval(() => {
// ping the peer for keep alive
// also update the peer store with the latency
libp2pPing
.ping(peerId)
.then((ping) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/src/libp2p/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function selectRandomPeer(peers: Peer[]): Peer | undefined {

/**
* Returns the peer with the lowest latency.
* @param getPing - A function that returns the latency for a given peer
* @param peerStore - The Libp2p PeerStore
* @param peers - The list of peers to choose from
* @returns The peer with the lowest latency, or undefined if no peer could be reached
*/
Expand Down

0 comments on commit b132ffe

Please sign in to comment.