Skip to content

Commit

Permalink
fix stalling db closing in case there is exp backoff for connectin ac…
Browse files Browse the repository at this point in the history
…tive
  • Loading branch information
Termina1 committed Nov 22, 2024
1 parent 5f651fb commit 2102e0b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion protocol/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,11 @@ func (n *Net) KeepConnecting(ctx context.Context, name string, addrs []string) {
if err != nil {
n.log.Error("net: couldn't connect", "name", name, "err", err)

time.Sleep(connBackoff)
select {
case <-time.After(connBackoff):
case <-ctx.Done():
break
}
connBackoff = min(MAX_RETRY_PERIOD, connBackoff*2)

continue
Expand Down

0 comments on commit 2102e0b

Please sign in to comment.