diff --git a/go.mod b/go.mod index 8227fce95ee33edadce3b6f642d83af1725ad38b..999255e276c7ddea708a90c8ca629472c76c31cf 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,7 @@ module github.com/apache/dubbo-go require ( - github.com/dubbogo/getty v1.0.7 + github.com/dubbogo/getty v1.1.2-0.20190709001822-cd6ab9c84ebc github.com/dubbogo/gost v1.1.1 github.com/dubbogo/hessian2 v1.2.0 github.com/magiconair/properties v1.8.1 diff --git a/go.sum b/go.sum index d44c5b27803f64c5985093e6f57151506e8a259e..57a2666c49a4431527b72ccad9162fa79c15c1ed 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,9 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dubbogo/getty v1.0.7 h1:5Hg+JwXyCKm9Yr4yJkm98ahhnoa8c2h6br5QJxwQ+YU= -github.com/dubbogo/getty v1.0.7/go.mod h1:cRMSuoCmwc5lULFFnYZTxyCfZhObmRTNbS7XRnPNHSo= +github.com/dubbogo/getty v1.1.2-0.20190709001822-cd6ab9c84ebc h1:HLvcjXfrrfeyoA2IpEymaE1npIMjtPvzzXdCvPbua9Y= +github.com/dubbogo/getty v1.1.2-0.20190709001822-cd6ab9c84ebc/go.mod h1:p9Pyk18a+5Aa0GZ546aCzlehEfvEof0jAF0+QQcEPYQ= +github.com/dubbogo/gost v1.0.1-0.20190706005735-65c3ecbba418/go.mod h1:R7wZm1DrmrKGr50mBZVcg6C9ekG8aL5hP+sgWcIDwQg= github.com/dubbogo/gost v1.1.1 h1:JCM7vx5edPIjDA5ovJTuzEEXuw2t7xLyrlgi2mi5jHI= github.com/dubbogo/gost v1.1.1/go.mod h1:R7wZm1DrmrKGr50mBZVcg6C9ekG8aL5hP+sgWcIDwQg= github.com/dubbogo/hessian2 v1.2.0 h1:5wFYuMzzRhneUAPbVBVKubIknrEjUM/B76vievYD0Vw= diff --git a/remoting/zookeeper/facade.go b/remoting/zookeeper/facade.go index 6e14e7a02d5b54ae0f01ad4728ef558a0493bb4d..4eace5e9d540ac86ca01683963b19ae547c7c732 100644 --- a/remoting/zookeeper/facade.go +++ b/remoting/zookeeper/facade.go @@ -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 <-wheel.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}", diff --git a/remoting/zookeeper/listener.go b/remoting/zookeeper/listener.go index f05246b6137b267a1c3c0e0a40388cbbe34a5a7d..44fe7eabadde883db852b880eb997444f3f48050 100644 --- a/remoting/zookeeper/listener.go +++ b/remoting/zookeeper/listener.go @@ -24,7 +24,7 @@ import ( ) import ( - gxtime "github.com/dubbogo/gost/time" + "github.com/dubbogo/getty" perrors "github.com/pkg/errors" "github.com/samuel/go-zookeeper/zk" ) @@ -34,10 +34,6 @@ import ( "github.com/apache/dubbo-go/remoting" ) -var ( - wheel = gxtime.NewWheel(gxtime.TimeSecondDuration(ConnDelay), MaxFailTimes+1) // wheel longest span is 2 minute -) - type ZkEventListener struct { client *ZookeeperClient pathMapLock sync.Mutex @@ -193,7 +189,7 @@ func (l *ZkEventListener) listenDirEvent(zkPath string, listener remoting.DataLi } l.client.RegisterEvent(zkPath, &event) select { - case <-wheel.After(timeSecondDuration(failTimes * ConnDelay)): + case <-getty.GetTimeWheel().After(timeSecondDuration(failTimes * ConnDelay)): l.client.UnregisterEvent(zkPath, &event) continue case <-l.client.Done():