wolfstudy commented on a change in pull request #492:
URL: https://github.com/apache/pulsar-client-go/pull/492#discussion_r602066698



##########
File path: pulsar/internal/rpc_client.go
##########
@@ -139,29 +144,30 @@ func (c *rpcClient) Request(logicalAddr *url.URL, 
physicalAddr *url.URL, request
        case res := <-ch:
                return res.RPCResult, res.error
        case <-time.After(c.requestTimeout):
-               return nil, errors.New("request timed out")
+               return nil, ErrRequestTimeOut
        }
 }
 
 func (c *rpcClient) RequestOnCnx(cnx Connection, requestID uint64, cmdType 
pb.BaseCommand_Type,
        message proto.Message) (*RPCResult, error) {
        c.metrics.RPCRequestCount.Inc()
-       wg := sync.WaitGroup{}
-       wg.Add(1)
 
-       rpcResult := &RPCResult{
-               Cnx: cnx,
-       }
+       ch := make(chan result, 1)

Review comment:
       Can we consider adjusting the size of the channel buffer appropriately? 
It looks like 10 is a good choice?




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


Reply via email to