fix S1000 simplify ch switch cases

Signed-off-by: Ken Sipe <kensipe@gmail.com>
This commit is contained in:
Ken Sipe 2020-06-26 10:45:30 -05:00
parent b287287a30
commit 268c2f81c7
No known key found for this signature in database
GPG Key ID: 564882A82432498D
2 changed files with 5 additions and 8 deletions

View File

@ -195,9 +195,7 @@ func ClockWait(clk *clock.FakeEventClock, counter counter.GoRoutineCounter, dura
close(dunch)
}, duration)
counter.Add(-1)
select {
case <-dunch:
}
<-dunch
}
func init() {

View File

@ -25,8 +25,9 @@ import (
"time"
"k8s.io/apimachinery/pkg/util/clock"
"k8s.io/apiserver/pkg/util/flowcontrol/counter"
"k8s.io/klog/v2"
"k8s.io/apiserver/pkg/util/flowcontrol/counter"
)
// EventFunc does some work that needs to be done at or after the
@ -51,10 +52,8 @@ type RealEventClock struct {
func (RealEventClock) EventAfterDuration(f EventFunc, d time.Duration) {
ch := time.After(d)
go func() {
select {
case t := <-ch:
f(t)
}
t := <-ch
f(t)
}()
}