mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 04:27:54 +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)
|
close(dunch)
|
||||||
}, duration)
|
}, duration)
|
||||||
counter.Add(-1)
|
counter.Add(-1)
|
||||||
select {
|
<-dunch
|
||||||
case <-dunch:
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -25,8 +25,9 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/util/clock"
|
"k8s.io/apimachinery/pkg/util/clock"
|
||||||
"k8s.io/apiserver/pkg/util/flowcontrol/counter"
|
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
|
|
||||||
|
"k8s.io/apiserver/pkg/util/flowcontrol/counter"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EventFunc does some work that needs to be done at or after the
|
// 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) {
|
func (RealEventClock) EventAfterDuration(f EventFunc, d time.Duration) {
|
||||||
ch := time.After(d)
|
ch := time.After(d)
|
||||||
go func() {
|
go func() {
|
||||||
select {
|
t := <-ch
|
||||||
case t := <-ch:
|
|
||||||
f(t)
|
f(t)
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user