Skip to content

Commit

Permalink
Improving PB reconnect counter
Browse files Browse the repository at this point in the history
  • Loading branch information
daonb committed Sep 23, 2024
1 parent e0b8ff4 commit 5e2b175
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/peerbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ export class PeerbookConnection {
let np: ConnectParams = {}
if (params)
np = {...params}
// remove the first message
if (!np.count)
np.count = 1
/* TODO: remove the count and figure a way to stop endless retries
Expand All @@ -117,13 +116,15 @@ export class PeerbookConnection {
*/
terminal7.run(() => {
terminal7.log("Retrying connection to PeerBook")
np.count++
if (np.count < 5) {
np.count++
}
this.connect(np).then(resolve).catch(reject)
.finally(() => {
if (this.session && msgs.length)
this.session.pendingCDCMsgs = msgs
})
}, 10)
}, np.count * 1000)
})
}

Expand Down

0 comments on commit 5e2b175

Please sign in to comment.