Skip to content

Commit

Permalink
chore: update pex initial backoff (#3266)
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Ma <[email protected]>
  • Loading branch information
jim3ma authored May 14, 2024
1 parent 7c69d5d commit dc4540d
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions client/daemon/pex/peer_exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,17 +224,30 @@ func (p *peerExchange) Serve(localMember *MemberMeta) error {
go p.memberManager.broadcastInBackground()
go p.reSyncMember()

for {
if err := p.serve(); err == nil {
break
}
}
p.serve()

<-p.stopCh
return nil
}

func (p *peerExchange) serve() error {
func (p *peerExchange) serve() {
for {
err := p.listAndJoin()
if err == nil {
return
}

select {
case <-p.stopCh:
return
default:
}

time.Sleep(p.config.initialRetryInterval)
}
}

func (p *peerExchange) listAndJoin() error {
var (
members []*InitialMember
err error
Expand Down

0 comments on commit dc4540d

Please sign in to comment.