mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 21:53:52 +00:00
Replace calls to time.After with time.NewTimer for explicit stopping
This commit is contained in:
@@ -89,7 +89,12 @@ func poller(interval, timeout time.Duration) WaitFunc {
|
||||
defer tick.Stop()
|
||||
var after <-chan time.Time
|
||||
if timeout != 0 {
|
||||
after = time.After(timeout)
|
||||
// time.After is more convenient, but it
|
||||
// potentially leaves timers around much longer
|
||||
// than necessary if we exit early.
|
||||
timer := time.NewTimer(timeout)
|
||||
after = timer.C
|
||||
defer timer.Stop()
|
||||
}
|
||||
for {
|
||||
select {
|
||||
|
Reference in New Issue
Block a user