Skip to content

Commit

Permalink
fix: cr
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenceLiZhixin committed Feb 5, 2021
1 parent 42f9947 commit 4135457
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 6 additions & 5 deletions cluster/cluster_impl/base_cluster_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ func (invoker *baseClusterInvoker) doSelectInvoker(lb cluster.LoadBalance, invoc
for i := 0; i < 3; i++ {
if len(otherInvokers) == 0 {
// no other ivk to reselect, return to fallback
logger.Errorf("all %d invokers is unavailable for %s.", len(invokers), selectedInvoker.GetUrl().String())
return nil
break
}
reselectedInvoker := lb.Select(otherInvokers, invocation)
if isInvoked(reselectedInvoker, invoked) {
Expand All @@ -158,11 +157,13 @@ func (invoker *baseClusterInvoker) doSelectInvoker(lb cluster.LoadBalance, invoc
otherInvokers = getOtherInvokers(otherInvokers, reselectedInvoker)
continue
}
selectedInvoker = reselectedInvoker
break
return reselectedInvoker
}
} else {
return selectedInvoker
}
return selectedInvoker
logger.Errorf("all %d invokers is unavailable for %s.", len(invokers), selectedInvoker.GetUrl().String())
return nil
}

func (invoker *baseClusterInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result {
Expand Down
6 changes: 2 additions & 4 deletions protocol/rpc_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,8 @@ func TryRefreshBlackList() {
go func(ivks []Invoker, i int) {
defer wg.Done()
for j, _ := range ivks {
if j%3-i == 0 {
if ivks[j].(Invoker).IsAvailable() {
RemoveInvokerUnhealthyStatus(ivks[i])
}
if j%3-i == 0 && ivks[j].(Invoker).IsAvailable() {
RemoveInvokerUnhealthyStatus(ivks[i])
}
}
}(ivks, i)
Expand Down

0 comments on commit 4135457

Please sign in to comment.