mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
Merge pull request #55128 from foxyriver/fix-timer
Automatic merge from submit-queue (batch tested with PRs 54602, 54877, 55243, 55509, 55128). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. stop timer **What this PR does / why we need it**: stop the timer after using it
This commit is contained in:
commit
8bdd6614f1
@ -104,6 +104,7 @@ func (a *poller) bootstrapping() {
|
|||||||
// bootstrapGracePeriod is read-only, so no lock is required
|
// bootstrapGracePeriod is read-only, so no lock is required
|
||||||
timer := time.NewTimer(a.bootstrapGracePeriod)
|
timer := time.NewTimer(a.bootstrapGracePeriod)
|
||||||
go func() {
|
go func() {
|
||||||
|
defer timer.Stop()
|
||||||
<-timer.C
|
<-timer.C
|
||||||
a.lock.Lock()
|
a.lock.Lock()
|
||||||
defer a.lock.Unlock()
|
defer a.lock.Unlock()
|
||||||
|
@ -50,6 +50,7 @@ func TestTolerateBootstrapFailure(t *testing.T) {
|
|||||||
go func() {
|
go func() {
|
||||||
// The test might have false negative, but won't be flaky
|
// The test might have false negative, but won't be flaky
|
||||||
timer := time.NewTimer(2 * time.Second)
|
timer := time.NewTimer(2 * time.Second)
|
||||||
|
defer timer.Stop()
|
||||||
<-timer.C
|
<-timer.C
|
||||||
fakeGetSucceedLock.Lock()
|
fakeGetSucceedLock.Lock()
|
||||||
defer fakeGetSucceedLock.Unlock()
|
defer fakeGetSucceedLock.Unlock()
|
||||||
|
Loading…
Reference in New Issue
Block a user