fix: use 5s timeout in discv5 iterator

This commit is contained in:
Richard Ramos 2023-05-08 12:29:18 -04:00
parent 9b7ad40b06
commit ac75160817
No known key found for this signature in database
GPG Key ID: 1CE87DB518195760
1 changed files with 5 additions and 2 deletions

View File

@ -313,12 +313,15 @@ restartLoop:
err := d.iterate(ctx)
if err != nil {
d.log.Debug("iterating discv5", zap.Error(err))
time.Sleep(2 * time.Second)
}
t := time.NewTimer(5 * time.Second)
select {
case <-t.C:
t.Stop()
case <-ctx.Done():
t.Stop()
break restartLoop
default:
}
}
d.log.Warn("Discv5 loop stopped")