You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ratis.apache.org by GitBox <gi...@apache.org> on 2020/07/09 11:15:58 UTC

[GitHub] [incubator-ratis] lokeshj1703 commented on a change in pull request #129: RATIS-868. Fix Failed UT: TestRaftWithSimulatedRpc#testWithLoad

lokeshj1703 commented on a change in pull request #129:
URL: https://github.com/apache/incubator-ratis/pull/129#discussion_r452142452



##########
File path: ratis-server/src/test/java/org/apache/ratis/server/simulation/SimulatedRequestReply.java
##########
@@ -130,19 +130,23 @@ public REQUEST takeRequest(String qid) throws IOException {
       throw new IOException("The RPC of " + qid + " has already shutdown.");
     }
 
-    final REQUEST request;
+    REQUEST request;
     try {
       // delay request for testing
       RaftTestUtil.delay(q.delayTakeRequestTo::get);
-
-      request = q.takeRequest();
-      Preconditions.assertTrue(qid.equals(request.getReplierId()));
-
-      // block request for testing
-      final EventQueue<REQUEST, REPLY> reqQ = queues.get(request.getRequestorId());
-      if (reqQ != null) {
-        RaftTestUtil.delay(reqQ.delayTakeRequestFrom::get);
-        RaftTestUtil.block(reqQ.blockTakeRequestFrom::get);
+      while (true) {
+        request = q.takeRequest();
+        Preconditions.assertTrue(qid.equals(request.getReplierId()));
+
+        final EventQueue<REQUEST, REPLY> reqQ = queues.get(request.getRequestorId());
+        if (reqQ != null) {
+          // discard request for testing

Review comment:
       We can update the comment that we are doing a busy wait here.




----------------------------------------------------------------
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:
users@infra.apache.org