cserwen commented on code in PR #6575:
URL: https://github.com/apache/rocketmq/pull/6575#discussion_r1163632841


##########
client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:
##########
@@ -1462,25 +1458,23 @@ public Message request(final Message msg, final 
MessageQueueSelector selector, f
         final String correlationId = 
msg.getProperty(MessageConst.PROPERTY_CORRELATION_ID);
 
         try {
-            final RequestResponseFuture requestResponseFuture = new 
RequestResponseFuture(correlationId, timeout, null);
-            
RequestFutureHolder.getInstance().getRequestFutureTable().put(correlationId, 
requestResponseFuture);
+            final RequestResponseFuture responseFuture = new 
RequestResponseFuture(correlationId, timeout, null);
+            
RequestFutureHolder.getInstance().getRequestFutureTable().put(correlationId, 
responseFuture);
 
             long cost = System.currentTimeMillis() - beginTimestamp;
             this.sendSelectImpl(msg, selector, arg, CommunicationMode.ASYNC, 
new SendCallback() {
                 @Override
                 public void onSuccess(SendResult sendResult) {
-                    requestResponseFuture.setSendRequestOk(true);
+                    requestSuccess(correlationId, new Message(msg.getTopic(), 
msg.getBody()));
                 }
 
                 @Override
                 public void onException(Throwable e) {
-                    requestResponseFuture.setSendRequestOk(false);
-                    requestResponseFuture.putResponseMessage(null);
-                    requestResponseFuture.setCause(e);
+                    requestFail(correlationId, e);
                 }
             }, timeout - cost);
 
-            return waitResponse(msg, timeout, requestResponseFuture, cost);
+            return waitResponse(msg, timeout - cost, responseFuture, cost);

Review Comment:
   > time - cost More accurate, cost is pre handler time
   
   +1



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to