wenxuwan commented on a change in pull request #1045:
URL: https://github.com/apache/dubbo-go/pull/1045#discussion_r573836198
##########
File path: protocol/dubbo/dubbo_invoker.go
##########
@@ -87,15 +93,31 @@ func (di *DubboInvoker) Invoke(ctx context.Context,
invocation protocol.Invocati
err error
result protocol.RPCResult
)
- if atomic.LoadInt64(&di.reqNum) < 0 {
+ if !di.BaseInvoker.IsAvailable() {
// Generally, the case will not happen, because the invoker has
been removed
// from the invoker list before destroy,so no new request will
enter the destroyed invoker
logger.Warnf("this dubboInvoker is destroyed")
- result.Err = ErrDestroyedInvoker
+ result.Err = protocol.ErrDestroyedInvoker
+ return &result
+ }
+
+ di.clientGuard.RLock()
+ defer di.clientGuard.RUnlock()
+
+ client := di.client
Review comment:
here we use Rlock to protect client, so we can use di.client directly,
new variable client is not needed
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]