wenfengwang commented on a change in pull request #97: fix remote timeout unit 
and add shutdown method
URL: https://github.com/apache/rocketmq-client-go/pull/97#discussion_r301385470
 
 

 ##########
 File path: internal/kernel/client.go
 ##########
 @@ -175,19 +199,33 @@ func (c *RMQClient) ClientID() string {
 
 func (c *RMQClient) InvokeSync(addr string, request *remote.RemotingCommand,
        timeoutMillis time.Duration) (*remote.RemotingCommand, error) {
-       return c.remoteClient.InvokeSync(addr, request, timeoutMillis)
+       if c.state {
+               return c.remoteClient.InvokeSync(addr, request, timeoutMillis)
+       } else {
+               return nil, ErrServiceState
+       }
 }
 
 func (c *RMQClient) InvokeAsync(addr string, request *remote.RemotingCommand,
        timeoutMillis time.Duration, f func(*remote.RemotingCommand, error)) 
error {
-       return c.remoteClient.InvokeAsync(addr, request, timeoutMillis, 
func(future *remote.ResponseFuture) {
-               f(future.ResponseCommand, future.Err)
-       })
+       if c.state {
+               return c.remoteClient.InvokeAsync(addr, request, timeoutMillis, 
func(future *remote.ResponseFuture) {
+                       f(future.ResponseCommand, future.Err)
+               })
+       } else {
 
 Review comment:
   > `else` is not needed.
   > 
   > ```go
   > if c.close {
   >   return nil, ErrServiceState
   > }
   > return return c.remoteClient.InvokeSync(addr, request, timeoutMillis)
   > ```
   
   

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


With regards,
Apache Git Services

Reply via email to