You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by GitBox <gi...@apache.org> on 2022/10/25 03:16:47 UTC

[GitHub] [rocketmq] lizhanhui commented on a diff in pull request #5397: [ISSUE #5331]Fix ConsumeQueueTest stable sleep cause NPE.

lizhanhui commented on code in PR #5397:
URL: https://github.com/apache/rocketmq/pull/5397#discussion_r1003957435


##########
store/src/test/java/org/apache/rocketmq/store/ConsumeQueueTest.java:
##########
@@ -250,7 +250,11 @@ public void testPutMessagePositionInfo_buildCQRepeatedly() throws Exception {
             for (int i = 0; i < totalMessages; i++) {
                 putMsg(messageStore);
             }
-            Thread.sleep(5);
+
+            // Wait consume queue build finish.
+            while (messageStore.dispatchBehindBytes() > 0) {

Review Comment:
   5 seconds is pretty long duration... Best to use awaitability to use finer  granularity.
   
    Awaitility.with().pollInterval(100, TimeUnit.MILLISECONDS).await().until(() -> {
                   return store.dispatchBehindBytes() == 0;
               });



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

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