Commit cdc4aca9 authored by foxyriver's avatar foxyriver

stop timer

parent 21062657
...@@ -104,6 +104,7 @@ func (a *poller) bootstrapping() { ...@@ -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) { ...@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment