gaoxinge commented on a change in pull request #1045:
URL: https://github.com/apache/dubbo-go/pull/1045#discussion_r571572642



##########
File path: protocol/dubbo/dubbo_invoker.go
##########
@@ -162,27 +181,38 @@ func (di *DubboInvoker) getTimeout(invocation 
*invocation_impl.RPCInvocation) ti
 }
 
 func (di *DubboInvoker) IsAvailable() bool {
-       return di.client.IsAvailable()
+       client := di.getClient()
+       if client != nil {
+               return client.IsAvailable()
+       }
+
+       return false
 }
 
 // Destroy destroy dubbo client invoker.
 func (di *DubboInvoker) Destroy() {
        di.quitOnce.Do(func() {
+               di.BaseInvoker.Stop()
+               var times int64
                for {
-                       if di.reqNum == 0 {
-                               di.reqNum = -1
-                               logger.Infof("dubboInvoker is 
destroyed,url:{%s}", di.GetUrl().Key())
+                       times = di.BaseInvoker.InvokeTimes()
+                       if times == 0 {
+                               di.BaseInvoker.AddInvokerTimes(-1)

Review comment:
       Why set invoke time to -1?

##########
File path: protocol/dubbo/dubbo_invoker.go
##########
@@ -87,15 +93,24 @@ 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() {

Review comment:
       This check is duplicated to below. What is it intended for?




----------------------------------------------------------------
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]

Reply via email to