jonyhy96 commented on a change in pull request #492:
URL: https://github.com/apache/pulsar-client-go/pull/492#discussion_r602090789
##########
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:
0 maybe enough for this because there will be only one result sends to
`ch` . Set it to 1 to prevent block happens on the sender side.
--
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]