Skip to content

Commit

Permalink
catchup: do not loop forever if there is no peers
Browse files Browse the repository at this point in the history
* Add context cancellation check to fetchRound peers retrieval loop
* This prevented some e2e tests to finish when a other nodes quit
  but the last node fell into catchup mode
  • Loading branch information
algorandskiy committed Jun 20, 2024
1 parent d02ee6a commit 7a60a70
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions catchup/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,13 @@ func (s *Service) fetchRound(cert agreement.Certificate, verifier *agreement.Asy
psp, getPeerErr := ps.getNextPeer()
if getPeerErr != nil {
s.log.Debugf("fetchRound: was unable to obtain a peer to retrieve the block from")
select {
case <-s.ctx.Done():
logging.Base().Debugf("fetchRound was asked to quit while collecting peers")
return
default:
}

s.net.RequestConnectOutgoing(true, s.ctx.Done())
continue
}
Expand Down

0 comments on commit 7a60a70

Please sign in to comment.