Skip to content

Commit

Permalink
creating new ticker each time leaks resources
Browse files Browse the repository at this point in the history
  • Loading branch information
shotasilagadzetaal committed Jul 8, 2024
1 parent 5d6f580 commit 575ae4f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,10 @@ func (p *Peer) reconnect() {
p.logger.Warn("Failed to connect to peer", slog.String(errKey, connectErr.Error()))
}

ticker := time.NewTicker(reconnectInterval)
for {
select {
case <-time.NewTicker(reconnectInterval).C:
case <-ticker.C:
if p.Connected() || p.Connecting() {
continue
}
Expand Down

0 comments on commit 575ae4f

Please sign in to comment.