Skip to content

Commit

Permalink
reset backoff before releasing semaphore
Browse files Browse the repository at this point in the history
  • Loading branch information
jrick committed Jan 27, 2025
1 parent 2d7ec6d commit 9438178
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spv/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,16 +704,16 @@ func (s *Syncer) connectToCandidates(ctx context.Context) error {
jitter := backoffJitter()
delay := time.Until(b.time) + jitter
connected := s.connectAndRunPeer(ctx, delay, raddr, false)
wg.Done()
<-sem

if connected {
s.setBackoff(raddr, backoff{})
} else {
b.duration = nextBackoff(b.duration + jitter)
b.time = time.Now().Add(b.duration)
s.setBackoff(raddr, b)
}

wg.Done()
<-sem
}()
}
}
Expand Down

0 comments on commit 9438178

Please sign in to comment.