mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 11:38:15 +00:00
fix S1000 simplify ch switch cases
Signed-off-by: Ken Sipe <kensipe@gmail.com>
This commit is contained in:
parent
b287287a30
commit
268c2f81c7
@ -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() {
|
||||
|
@ -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)
|
||||
}()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user