Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
22a7f0099
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2022
22a7f0099
Commits
2a924dcb
Commit
2a924dcb
authored
4 years ago
by
邹毅贤
Browse files
Options
Downloads
Patches
Plain Diff
Trigger init router for first call
parent
4ea5d0a7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cluster/router/chain/chain.go
+9
-0
9 additions, 0 deletions
cluster/router/chain/chain.go
with
9 additions
and
0 deletions
cluster/router/chain/chain.go
+
9
−
0
View file @
2a924dcb
...
...
@@ -65,6 +65,8 @@ type RouterChain struct {
notify
chan
struct
{}
// Address cache
cache
atomic
.
Value
// init
init
sync
.
Once
}
// Route Loop routers in RouterChain and call Route method to determine the target invokers list.
...
...
@@ -111,6 +113,13 @@ func (c *RouterChain) SetInvokers(invokers []protocol.Invoker) {
c
.
invokers
=
invokers
c
.
mutex
.
Unlock
()
// it should trigger init router for first call
c
.
init
.
Do
(
func
()
{
go
func
()
{
c
.
notify
<-
struct
{}{}
}()
})
c
.
count
++
now
:=
time
.
Now
()
if
c
.
count
>=
countThreshold
&&
now
.
Sub
(
c
.
last
)
>=
timeThreshold
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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