Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
22a7f0099
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2022
22a7f0099
Commits
f43d5e76
Commit
f43d5e76
authored
Jul 16, 2019
by
aliiohs
Browse files
Options
Downloads
Patches
Plain Diff
change select time.After to wheel.After
parent
197f248f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
remoting/zookeeper/listener.go
+6
-1
6 additions, 1 deletion
remoting/zookeeper/listener.go
with
6 additions
and
1 deletion
remoting/zookeeper/listener.go
+
6
−
1
View file @
f43d5e76
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
package
zookeeper
package
zookeeper
import
(
import
(
gxtime
"github.com/dubbogo/gost/time"
"path"
"path"
"sync"
"sync"
"time"
"time"
...
@@ -33,6 +34,10 @@ import (
...
@@ -33,6 +34,10 @@ import (
"github.com/apache/dubbo-go/remoting"
"github.com/apache/dubbo-go/remoting"
)
)
var
(
wheel
=
gxtime
.
NewWheel
(
gxtime
.
TimeSecondDuration
(
3
),
12
)
// wheel longest span is 2 minute
)
type
ZkEventListener
struct
{
type
ZkEventListener
struct
{
client
*
ZookeeperClient
client
*
ZookeeperClient
pathMapLock
sync
.
Mutex
pathMapLock
sync
.
Mutex
...
@@ -188,7 +193,7 @@ func (l *ZkEventListener) listenDirEvent(zkPath string, listener remoting.DataLi
...
@@ -188,7 +193,7 @@ func (l *ZkEventListener) listenDirEvent(zkPath string, listener remoting.DataLi
}
}
l
.
client
.
RegisterEvent
(
zkPath
,
&
event
)
l
.
client
.
RegisterEvent
(
zkPath
,
&
event
)
select
{
select
{
case
<-
time
.
After
(
timeSecondDuration
(
failTimes
*
ConnDelay
))
:
case
<-
wheel
.
After
(
timeSecondDuration
(
failTimes
*
ConnDelay
))
:
l
.
client
.
UnregisterEvent
(
zkPath
,
&
event
)
l
.
client
.
UnregisterEvent
(
zkPath
,
&
event
)
continue
continue
case
<-
l
.
client
.
Done
()
:
case
<-
l
.
client
.
Done
()
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment