You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/07/17 01:32:49 UTC
[dubbo-go] branch 1.5 updated: fix: deadlock (#1314)
This is an automated email from the ASF dual-hosted git repository.
alexstocks pushed a commit to branch 1.5
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/1.5 by this push:
new 2c4ec27 fix: deadlock (#1314)
2c4ec27 is described below
commit 2c4ec27dc67c7a349d30d72dd0f3b7c51e5dbfce
Author: Laurence <45...@users.noreply.github.com>
AuthorDate: Sat Jul 17 09:32:39 2021 +0800
fix: deadlock (#1314)
* fix: deadlock
* fix: reset
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix
* fix: linter
* fix: update golang ci lint version
* fix
* fix
* fix
* fix: change to gost chanx
* fix
* fix
---
.github/workflows/github-actions.yml | 2 +-
config_center/nacos/impl.go | 2 +-
go.mod | 12 +++------
go.sum | 47 ++++++++++++++++++++++++------------
registry/etcdv3/listener.go | 16 ++++++------
registry/kubernetes/listener.go | 16 ++++++------
registry/nacos/listener.go | 17 +++++++------
registry/zookeeper/listener.go | 18 ++++++++------
remoting/zookeeper/listener.go | 1 -
9 files changed, 75 insertions(+), 56 deletions(-)
diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml
index 475258b..e664a7b 100644
--- a/.github/workflows/github-actions.yml
+++ b/.github/workflows/github-actions.yml
@@ -60,7 +60,7 @@ jobs:
# diff -u <(echo -n) <(gofmt -d -s .)
- name: Install go ci lint
- run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.27.0
+ run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.41.1
- name: Run Linter
run: golangci-lint run --timeout=10m -v
diff --git a/config_center/nacos/impl.go b/config_center/nacos/impl.go
index 82a903b..fdb43b9 100644
--- a/config_center/nacos/impl.go
+++ b/config_center/nacos/impl.go
@@ -118,7 +118,7 @@ func (n *nacosDynamicConfiguration) PublishConfig(key string, group string, valu
// GetConfigKeysByGroup will return all keys with the group
func (n *nacosDynamicConfiguration) GetConfigKeysByGroup(group string) (*gxset.HashSet, error) {
group = n.resolvedGroup(group)
- page, err := (*n.client.Client()).SearchConfig(vo.SearchConfigParm{
+ page, err := (*n.client.Client()).SearchConfig(vo.SearchConfigParam{
Search: "accurate",
Group: group,
PageNo: 1,
diff --git a/go.mod b/go.mod
index bab75f6..a95f0aa 100644
--- a/go.mod
+++ b/go.mod
@@ -7,22 +7,18 @@ require (
github.com/Workiva/go-datastructures v1.0.52
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5
github.com/alibaba/sentinel-golang v1.0.2
- github.com/apache/dubbo-getty v1.4.4
- github.com/apache/dubbo-go-hessian2 v1.9.2
- github.com/coreos/bbolt v1.3.3 // indirect
+ github.com/apache/dubbo-getty v1.4.3
+ github.com/apache/dubbo-go-hessian2 v1.9.1
github.com/coreos/etcd v3.3.25+incompatible
- github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
github.com/creasty/defaults v1.5.1
github.com/dubbogo/go-zookeeper v1.0.3
- github.com/dubbogo/gost v1.11.13
+ github.com/dubbogo/gost v1.11.14
github.com/emicklei/go-restful/v3 v3.4.0
github.com/fsnotify/fsnotify v1.4.9
github.com/go-co-op/gocron v0.1.1
github.com/go-resty/resty/v2 v2.3.0
github.com/golang/mock v1.4.4
github.com/golang/protobuf v1.4.3
- github.com/google/uuid v1.2.0 // indirect
- github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645
github.com/hashicorp/consul v1.8.0
github.com/hashicorp/consul/api v1.5.0
@@ -50,8 +46,6 @@ require (
replace (
github.com/coreos/bbolt => go.etcd.io/bbolt v1.3.4
github.com/envoyproxy/go-control-plane => github.com/envoyproxy/go-control-plane v0.8.0
- github.com/golang/protobuf => github.com/golang/protobuf v1.3.2
github.com/shirou/gopsutil => github.com/shirou/gopsutil v0.0.0-20181107111621-48177ef5f880
- go.etcd.io/bbolt v1.3.4 => github.com/coreos/bbolt v1.3.3
google.golang.org/grpc => google.golang.org/grpc v1.26.0
)
diff --git a/go.sum b/go.sum
index b830836..e55ad32 100644
--- a/go.sum
+++ b/go.sum
@@ -80,10 +80,10 @@ github.com/alibaba/sentinel-golang v1.0.2/go.mod h1:QsB99f/z35D2AiMrAWwgWE85kDTk
github.com/aliyun/alibaba-cloud-sdk-go v1.61.18 h1:zOVTBdCKFd9JbCKz9/nt+FovbjPFmb7mUnp8nH9fQBA=
github.com/aliyun/alibaba-cloud-sdk-go v1.61.18/go.mod h1:v8ESoHo4SyHmuB4b1tJqDHxfTGEciD+yhvOU/5s1Rfk=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
-github.com/apache/dubbo-getty v1.4.4 h1:pthYQaCXyjHJ6/SjVwKkX5NhdAqSpUrRL1Z9GowrLdE=
-github.com/apache/dubbo-getty v1.4.4/go.mod h1:mcDyiu7M/TVrYDyL8TxDemQkOdvEqqHSQ4jOuYejY1w=
-github.com/apache/dubbo-go-hessian2 v1.9.2 h1:XuI8KvENSfKiAhiCBS4RNihmQDoPNmGWKT3gTui0p9A=
-github.com/apache/dubbo-go-hessian2 v1.9.2/go.mod h1:xQUjE7F8PX49nm80kChFvepA/AvqAZ0oh/UaB6+6pBE=
+github.com/apache/dubbo-getty v1.4.3 h1:PCKpryDasKOxwT5MBC6MIMO+0NLOaHF6Xco9YXQw7HI=
+github.com/apache/dubbo-getty v1.4.3/go.mod h1:ansXgKxxyhCOiQL29nO5ce1MDcEKmCyZuNR9oMs3hek=
+github.com/apache/dubbo-go-hessian2 v1.9.1 h1:ceSsU/9z/gv3hzUpl8GceEhQvF3i0BionfdHUGMmjHU=
+github.com/apache/dubbo-go-hessian2 v1.9.1/go.mod h1:xQUjE7F8PX49nm80kChFvepA/AvqAZ0oh/UaB6+6pBE=
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e h1:QEF07wC0T1rKkctt1RINW/+RMTVmiwxETico2l3gxJA=
@@ -144,9 +144,8 @@ github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee
github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
+github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e h1:Wf6HqHfScWJN9/ZjdUKyjop4mf3Qdd+1TvvltAvM3m8=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
-github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU=
-github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk=
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg=
@@ -181,9 +180,9 @@ github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZ
github.com/dubbogo/go-zookeeper v1.0.3 h1:UkuY+rBsxdT7Bs63QAzp9z7XqQ53W1j8E5rwl83me8g=
github.com/dubbogo/go-zookeeper v1.0.3/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c=
github.com/dubbogo/gost v1.9.0/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8=
-github.com/dubbogo/gost v1.11.12/go.mod h1:vIcP9rqz2KsXHPjsAwIUtfJIJjppQLQDcYaZTy/61jI=
-github.com/dubbogo/gost v1.11.13 h1:sWvK1QbHpPBMmRQJV9qIH3syLegQBQa4xAPof3/Kv5c=
-github.com/dubbogo/gost v1.11.13/go.mod h1:vIcP9rqz2KsXHPjsAwIUtfJIJjppQLQDcYaZTy/61jI=
+github.com/dubbogo/gost v1.10.1/go.mod h1:+mQGS51XQEUWZP2JeGZTxJwipjRKtJO7Tr+FOg+72rI=
+github.com/dubbogo/gost v1.11.14 h1:9lfcdILOmqTOVAW1fPHa5uf1NrD6jlIOBe4vf8576yQ=
+github.com/dubbogo/gost v1.11.14/go.mod h1:vIcP9rqz2KsXHPjsAwIUtfJIJjppQLQDcYaZTy/61jI=
github.com/dubbogo/jsonparser v1.0.1/go.mod h1:tYAtpctvSP/tWw4MeelsowSPgXQRVHHWbqL6ynps8jU=
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
@@ -277,8 +276,21 @@ github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
-github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
+github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
+github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
+github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
+github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
+github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
+github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
+github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
+github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
+github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
+github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
+github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
@@ -303,9 +315,8 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4
github.com/google/tcpproxy v0.0.0-20180808230851-dfa16c61dad2 h1:AtvtonGEH/fZK0XPNNBdB6swgy7Iudfx88wzyIpwqJ8=
github.com/google/tcpproxy v0.0.0-20180808230851-dfa16c61dad2/go.mod h1:DavVbd41y+b7ukKDmlnPR4nGYmkWXR6vHUkjQNiHPBs=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
+github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
-github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs=
-github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
@@ -333,9 +344,8 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92Bcuy
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
+github.com/grpc-ecosystem/grpc-gateway v1.14.6 h1:8ERzHx8aj1Sc47mu9n/AksaKCSWrMchFtkdrS4BIj5o=
github.com/grpc-ecosystem/grpc-gateway v1.14.6/go.mod h1:zdiPV4Yse/1gnckTHtghG4GkDEdKCRJduHpTxT3/jcw=
-github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
-github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 h1:MJG/KsmcqMwFAkh8mTnAwhyKoB+sTAnY4CACC110tbU=
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw=
github.com/hashicorp/consul v1.8.0 h1:yRKMKZyPLqUxl37t4nFt5OuGmTXoFhTJrakhfnYKCYA=
@@ -562,7 +572,6 @@ github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lN
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
-github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae h1:VeRdUYdCw49yizlSbMEn2SZ+gT+3IUKx8BqxyQdz+BY=
github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg=
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
@@ -753,6 +762,7 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
+github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
@@ -1040,6 +1050,13 @@ google.golang.org/genproto v0.0.0-20200806141610-86f49bd18e98 h1:LCO0fg4kb6WwkXQ
google.golang.org/genproto v0.0.0-20200806141610-86f49bd18e98/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/grpc v1.26.0 h1:2dTRdpdFEEhJYQD8EMLB61nnrzSCTbG38PhqdhvOltg=
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
+google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
+google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
+google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
+google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
+google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0 h1:UhZDfRO8JRQru4/+LlLE0BRKGF8L+PICnvYZmx/fEGA=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
diff --git a/registry/etcdv3/listener.go b/registry/etcdv3/listener.go
index f900495..8836fc2 100644
--- a/registry/etcdv3/listener.go
+++ b/registry/etcdv3/listener.go
@@ -23,6 +23,7 @@ import (
)
import (
+ gxchan "github.com/dubbogo/gost/container/chan"
perrors "github.com/pkg/errors"
)
@@ -81,7 +82,7 @@ func (l *dataListener) DataChange(eventType remoting.Event) bool {
type configurationListener struct {
registry *etcdV3Registry
- events chan *config_center.ConfigChangeEvent
+ events *gxchan.UnboundedChan
closeOnce sync.Once
}
@@ -89,12 +90,12 @@ type configurationListener struct {
func NewConfigurationListener(reg *etcdV3Registry) *configurationListener {
// add a new waiter
reg.WaitGroup().Add(1)
- return &configurationListener{registry: reg, events: make(chan *config_center.ConfigChangeEvent, 32)}
+ return &configurationListener{registry: reg, events: gxchan.NewUnboundedChan(32)}
}
// Process data change event from config center of etcd
func (l *configurationListener) Process(configType *config_center.ConfigChangeEvent) {
- l.events <- configType
+ l.events.In() <- configType
}
// Next returns next service event once received
@@ -105,17 +106,18 @@ func (l *configurationListener) Next() (*registry.ServiceEvent, error) {
logger.Warnf("listener's etcd client connection is broken, so etcd event listener exit now.")
return nil, perrors.New("listener stopped")
- case e := <-l.events:
+ case e := <-l.events.Out():
+ event, _ := e.(*config_center.ConfigChangeEvent)
logger.Infof("got etcd event %#v", e)
- if e.ConfigType == remoting.EventTypeDel && l.registry.client.Valid() {
+ if event.ConfigType == remoting.EventTypeDel && l.registry.client.Valid() {
select {
case <-l.registry.Done():
- logger.Warnf("update @result{%s}. But its connection to registry is invalid", e.Value)
+ logger.Warnf("update @result{%s}. But its connection to registry is invalid", event.Value)
default:
}
continue
}
- return ®istry.ServiceEvent{Action: e.ConfigType, Service: e.Value.(*common.URL)}, nil
+ return ®istry.ServiceEvent{Action: event.ConfigType, Service: event.Value.(*common.URL)}, nil
}
}
}
diff --git a/registry/kubernetes/listener.go b/registry/kubernetes/listener.go
index e20b7c7..ba3326b 100644
--- a/registry/kubernetes/listener.go
+++ b/registry/kubernetes/listener.go
@@ -22,6 +22,7 @@ import (
)
import (
+ gxchan "github.com/dubbogo/gost/container/chan"
perrors "github.com/pkg/errors"
)
@@ -81,19 +82,19 @@ func (l *dataListener) DataChange(eventType remoting.Event) bool {
type configurationListener struct {
registry *kubernetesRegistry
- events chan *config_center.ConfigChangeEvent
+ events *gxchan.UnboundedChan
}
// NewConfigurationListener for listening the event of kubernetes.
func NewConfigurationListener(reg *kubernetesRegistry) *configurationListener {
// add a new waiter
reg.WaitGroup().Add(1)
- return &configurationListener{registry: reg, events: make(chan *config_center.ConfigChangeEvent, 32)}
+ return &configurationListener{registry: reg, events: gxchan.NewUnboundedChan(32)}
}
// Process processes the data change event from config center of kubernetes
func (l *configurationListener) Process(configType *config_center.ConfigChangeEvent) {
- l.events <- configType
+ l.events.In() <- configType
}
// Next returns next service event once received
@@ -104,17 +105,18 @@ func (l *configurationListener) Next() (*registry.ServiceEvent, error) {
logger.Warnf("listener's kubernetes client connection is broken, so kubernetes event listener exits now.")
return nil, perrors.New("listener stopped")
- case e := <-l.events:
+ case e := <-l.events.Out():
+ event, _ := e.(*config_center.ConfigChangeEvent)
logger.Debugf("got kubernetes event %#v", e)
- if e.ConfigType == remoting.EventTypeDel && !l.registry.client.Valid() {
+ if event.ConfigType == remoting.EventTypeDel && !l.registry.client.Valid() {
select {
case <-l.registry.Done():
- logger.Warnf("update @result{%s}. But its connection to registry is invalid", e.Value)
+ logger.Warnf("update @result{%s}. But its connection to registry is invalid", event.Value)
default:
}
continue
}
- return ®istry.ServiceEvent{Action: e.ConfigType, Service: e.Value.(*common.URL)}, nil
+ return ®istry.ServiceEvent{Action: event.ConfigType, Service: event.Value.(*common.URL)}, nil
}
}
}
diff --git a/registry/nacos/listener.go b/registry/nacos/listener.go
index 5958df4..a6eacdd 100644
--- a/registry/nacos/listener.go
+++ b/registry/nacos/listener.go
@@ -26,6 +26,7 @@ import (
)
import (
+ gxchan "github.com/dubbogo/gost/container/chan"
"github.com/nacos-group/nacos-sdk-go/clients/naming_client"
"github.com/nacos-group/nacos-sdk-go/model"
"github.com/nacos-group/nacos-sdk-go/vo"
@@ -44,7 +45,7 @@ import (
type nacosListener struct {
namingClient naming_client.INamingClient
listenUrl *common.URL
- events chan *config_center.ConfigChangeEvent
+ events *gxchan.UnboundedChan
instanceMap map[string]model.Instance
cacheLock sync.Mutex
done chan struct{}
@@ -55,9 +56,10 @@ type nacosListener struct {
func NewNacosListener(url *common.URL, namingClient naming_client.INamingClient) (*nacosListener, error) {
listener := &nacosListener{
namingClient: namingClient,
- listenUrl: url, events: make(chan *config_center.ConfigChangeEvent, 32),
- instanceMap: map[string]model.Instance{},
- done: make(chan struct{}),
+ listenUrl: url,
+ events: gxchan.NewUnboundedChan(32),
+ instanceMap: map[string]model.Instance{},
+ done: make(chan struct{}),
}
err := listener.startListen()
return listener, err
@@ -199,7 +201,7 @@ func (nl *nacosListener) stopListen() error {
}
func (nl *nacosListener) process(configType *config_center.ConfigChangeEvent) {
- nl.events <- configType
+ nl.events.In() <- configType
}
// Next returns the service event from nacos.
@@ -210,9 +212,10 @@ func (nl *nacosListener) Next() (*registry.ServiceEvent, error) {
logger.Warnf("nacos listener is close!listenUrl:%+v", nl.listenUrl)
return nil, perrors.New("listener stopped")
- case e := <-nl.events:
+ case e := <-nl.events.Out():
+ event, _ := e.(*config_center.ConfigChangeEvent)
logger.Debugf("got nacos event %s", e)
- return ®istry.ServiceEvent{Action: e.ConfigType, Service: e.Value.(*common.URL)}, nil
+ return ®istry.ServiceEvent{Action: event.ConfigType, Service: event.Value.(*common.URL)}, nil
}
}
}
diff --git a/registry/zookeeper/listener.go b/registry/zookeeper/listener.go
index 5a7d14b..e658155 100644
--- a/registry/zookeeper/listener.go
+++ b/registry/zookeeper/listener.go
@@ -18,12 +18,13 @@
package zookeeper
import (
- gxzookeeper "github.com/dubbogo/gost/database/kv/zk"
"strings"
"sync"
)
import (
+ gxchan "github.com/dubbogo/gost/container/chan"
+ gxzookeeper "github.com/dubbogo/gost/database/kv/zk"
perrors "github.com/pkg/errors"
)
@@ -115,7 +116,7 @@ func (l *RegistryDataListener) Close() {
type RegistryConfigurationListener struct {
client *gxzookeeper.ZookeeperClient
registry *zkRegistry
- events chan *config_center.ConfigChangeEvent
+ events *gxchan.UnboundedChan // chan *config_center.ConfigChangeEvent
isClosed bool
close chan struct{}
closeOnce sync.Once
@@ -128,7 +129,7 @@ func NewRegistryConfigurationListener(client *gxzookeeper.ZookeeperClient, reg *
return &RegistryConfigurationListener{
client: client,
registry: reg,
- events: make(chan *config_center.ConfigChangeEvent, 32),
+ events: gxchan.NewUnboundedChan(32),
isClosed: false,
close: make(chan struct{}, 1),
subscribeURL: conf}
@@ -136,7 +137,7 @@ func NewRegistryConfigurationListener(client *gxzookeeper.ZookeeperClient, reg *
// Process submit the ConfigChangeEvent to the event chan to notify all observer
func (l *RegistryConfigurationListener) Process(configType *config_center.ConfigChangeEvent) {
- l.events <- configType
+ l.events.In() <- configType
}
// Next will observe the registry state and events chan
@@ -148,13 +149,14 @@ func (l *RegistryConfigurationListener) Next() (*registry.ServiceEvent, error) {
case <-l.registry.Done():
logger.Warnf("zk consumer register has quit, so zk event listener exit now. (registry url {%v}", l.registry.BaseRegistry.URL)
return nil, perrors.New("zookeeper registry, (registry url{%v}) stopped")
- case e := <-l.events:
+ case e := <-l.events.Out():
+ event, _ := e.(*config_center.ConfigChangeEvent)
logger.Debugf("got zk event %s", e)
- if e.ConfigType == remoting.EventTypeDel && !l.valid() {
- logger.Warnf("update @result{%s}. But its connection to registry is invalid", e.Value)
+ if event.ConfigType == remoting.EventTypeDel && !l.valid() {
+ logger.Warnf("update @result{%s}. But its connection to registry is invalid", event.Value)
continue
}
- return ®istry.ServiceEvent{Action: e.ConfigType, Service: e.Value.(*common.URL)}, nil
+ return ®istry.ServiceEvent{Action: event.ConfigType, Service: event.Value.(*common.URL)}, nil
}
}
}
diff --git a/remoting/zookeeper/listener.go b/remoting/zookeeper/listener.go
index c6a2f9c..9fcbf7f 100644
--- a/remoting/zookeeper/listener.go
+++ b/remoting/zookeeper/listener.go
@@ -29,7 +29,6 @@ import (
"github.com/dubbogo/go-zookeeper/zk"
gxzookeeper "github.com/dubbogo/gost/database/kv/zk"
perrors "github.com/pkg/errors"
-
uatomic "go.uber.org/atomic"
)