-
Notifications
You must be signed in to change notification settings - Fork 66
feat: 增加balancerFilter优先匹配 #97
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
base: master
Are you sure you want to change the base?
Conversation
@fengmk2 麻烦帮忙看一下啦,谢谢 |
Codecov Report
@@ Coverage Diff @@
## master #97 +/- ##
==========================================
+ Coverage 98.31% 98.33% +0.02%
==========================================
Files 38 38
Lines 2311 2344 +33
Branches 367 378 +11
==========================================
+ Hits 2272 2305 +33
Misses 39 39
Continue to review full report at Codecov.
|
@fengmk2 老哥这个还有合进去的可能么 |
如果可以的话,或者简单点这样,#100 把createLoadBalancer增加到参数里。把createLoadBalancer透出也方便去定制功能 const defaultOptions = {
loadbalancerClass: 'roundRobin',
retryFaultInterval: 30000, // 30s 重新尝试连接下不可用的地址
waitConnect: true,
createLoadBalancer,
};
class AddressGroup extends Base {
constructor(options = {}) {
...
this._loadbalancer = options.createLoadBalancer(this); |
#96
在使用registry的情况下,如果有较多的地址,在这里希望能够进行部分地址增加优先级优先掉用
我的需求: 如地址1、2、3 、4、5、6。希望能够先掉用 1、2、3,并且兜底不可用情况,重新走之前的逻辑 随机掉用1-6
所以在此增加一个
balancerFilter
,在_loadbalancer.select
之前先掉用一次,筛选出需要优先掉用的地址,优先连接一次。不可用时使用原逻辑。例子