-
Notifications
You must be signed in to change notification settings - Fork 933
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NewLeastActiveLoadBalance #65
NewLeastActiveLoadBalance #65
Conversation
"github.com/dubbo/go-for-apache-dubbo/filter" | ||
"github.com/dubbo/go-for-apache-dubbo/protocol" | ||
"math/rand" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import format
|
||
const ( | ||
leastActive = "leastactive" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const format
filter/RpcStatus.go
Outdated
"github.com/dubbo/go-for-apache-dubbo/common" | ||
"sync" | ||
"sync/atomic" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import format
filter/RpcStatus.go
Outdated
|
||
var ( | ||
methodStatistics = sync.Map{} // url -> { methodName : RpcStatus} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
methodStatistics sync.Map
"github.com/dubbo/go-for-apache-dubbo/common/extension" | ||
"github.com/dubbo/go-for-apache-dubbo/filter" | ||
"github.com/dubbo/go-for-apache-dubbo/protocol" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import format
) | ||
|
||
const active = "active" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const format
filter/RpcStatus.go
Outdated
@@ -0,0 +1,68 @@ | |||
// Licensed under the Apache License, Version 2.0 (the "License"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个文件放到protocol根目录下面吧。放到filter分类有点怪
cluster/loadbalance/least_active.go
Outdated
func (lb *leastActiveLoadBalance) Select(invokers []protocol.Invoker, invocation protocol.Invocation) protocol.Invoker { | ||
|
||
count := len(invokers) | ||
if invokers == nil || count == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
函数开始第一行不要空行,这里也是只判断下 if count == 0 即可
Codecov Report
@@ Coverage Diff @@
## master #65 +/- ##
==========================================
+ Coverage 61.95% 62.19% +0.24%
==========================================
Files 52 54 +2
Lines 3517 3574 +57
==========================================
+ Hits 2179 2223 +44
- Misses 1117 1128 +11
- Partials 221 223 +2
Continue to review full report at Codecov.
|
go.mod
Outdated
@@ -1,6 +1,7 @@ | |||
module github.com/apache/dubbo-go | |||
|
|||
require ( | |||
github.com/dubbo/go-for-apache-dubbo v1.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why require github.com/dubbo/go-for-apache-dubbo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be left over from history. Trying to delete it will cause ci to fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed it.
No description provided.