You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/02/09 03:44:56 UTC

[GitHub] [rocketmq] XiaoyiPeng commented on a change in pull request #3828: [ISSUE #3827]Improve Performance of Transactional Message

XiaoyiPeng commented on a change in pull request #3828:
URL: https://github.com/apache/rocketmq/pull/3828#discussion_r802242913



##########
File path: store/src/main/java/org/apache/rocketmq/store/DefaultMessageStore.java
##########
@@ -509,19 +510,27 @@ private boolean isLmqConsumeQueueNumExceeded() {
 
     @Override
     public PutMessageResult putMessage(MessageExtBrokerInner msg) {
-        try {
-            return asyncPutMessage(msg).get();
-        } catch (InterruptedException | ExecutionException e) {
-            return new PutMessageResult(PutMessageStatus.UNKNOWN_ERROR, null);
-        }
+        return waitForPutResult(asyncPutMessage(msg));
     }
 
     @Override
     public PutMessageResult putMessages(MessageExtBatch messageExtBatch) {
+        return waitForPutResult(asyncPutMessages(messageExtBatch));
+    }
+
+    private PutMessageResult waitForPutResult(CompletableFuture<PutMessageResult> putMessageResultFuture) {
         try {
-            return asyncPutMessages(messageExtBatch).get();
-        } catch (InterruptedException | ExecutionException e) {
+            int putMessageTimeout =
+                    Math.min(this.messageStoreConfig.getSyncFlushTimeout(), this.messageStoreConfig.getSlaveTimeout());
+            return putMessageResultFuture.get(putMessageTimeout, TimeUnit.MILLISECONDS);

Review comment:
       Can we make this parameter `putMessageTimeout` configurable?




-- 
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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org