Skip to content
Snippets Groups Projects
Commit f91dd011 authored by Xin.Zh's avatar Xin.Zh Committed by GitHub
Browse files

Merge pull request #130 from aliiohs/feature/FIxListenDIrEvent

Feature: use getty. GetTimeWheel().After in ListenDirEvent
parents 593c2a7f b97f6ede
No related branches found
No related tags found
No related merge requests found
......@@ -19,9 +19,9 @@ package zookeeper
import (
"sync"
"time"
)
import (
"github.com/dubbogo/getty"
perrors "github.com/pkg/errors"
)
......@@ -70,7 +70,7 @@ LOOP:
case <-r.GetDone():
logger.Warnf("(ZkProviderRegistry)reconnectZkRegistry goroutine exit now...")
break LOOP
case <-time.After(time.Duration(1e9 * failTimes * ConnDelay)): // 防止疯狂重连zk
case <-getty.GetTimeWheel().After(timeSecondDuration(failTimes * ConnDelay)): // 防止疯狂重连zk
}
err = ValidateZookeeperClient(r, WithZkName(zkName))
logger.Infof("ZkProviderRegistry.validateZookeeperClient(zkAddr{%s}) = error{%#v}",
......
......@@ -24,6 +24,7 @@ import (
)
import (
"github.com/dubbogo/getty"
perrors "github.com/pkg/errors"
"github.com/samuel/go-zookeeper/zk"
)
......@@ -188,7 +189,7 @@ func (l *ZkEventListener) listenDirEvent(zkPath string, listener remoting.DataLi
}
l.client.RegisterEvent(zkPath, &event)
select {
case <-time.After(timeSecondDuration(failTimes * ConnDelay)):
case <-getty.GetTimeWheel().After(timeSecondDuration(failTimes * ConnDelay)):
l.client.UnregisterEvent(zkPath, &event)
continue
case <-l.client.Done():
......
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