Skip to content

Commit

Permalink
select on context during sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
jrick authored and davecgh committed Apr 5, 2024
1 parent 56953a5 commit 360566a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3145,7 +3145,11 @@ func (s *server) querySeeders(ctx context.Context) {
return
}

time.Sleep(backoff)
select {
case <-time.After(backoff):
case <-ctx.Done():
return
}
if backoff < 10*time.Second {
backoff += time.Second
}
Expand Down

0 comments on commit 360566a

Please sign in to comment.