adamdebreceni commented on a change in pull request #861:
URL: https://github.com/apache/nifi-minifi-cpp/pull/861#discussion_r465030783



##########
File path: libminifi/test/flow-tests/FlowControllerTests.cpp
##########
@@ -133,12 +144,9 @@ TEST_CASE("Flow shutdown waits for a while", 
"[TestFlow2]") {
   testController.startFlow();
 
   // wait for the source processor to enqueue its flowFiles
-  int tryCount = 0;
-  while (tryCount++ < 10 && root->getTotalFlowFileCount() != 3) {
-    std::this_thread::sleep_for(std::chrono::milliseconds{20});
-  }
+  busy_wait(std::chrono::milliseconds{50}, [&] {return 
root->getTotalFlowFileCount() != 0;});

Review comment:
       the `sleep_for` inside the `verifyEventHappenedInPollTime` is 
problematic, as I would like to wait for the sourceProcessor to get executed 
once, and as it turns out a on the github agents a `sleep_for(20ms)` might 
happily wait more than `100ms` 
   
   (note that I can't signal the main thread from the `onTrigger` as the 
shutdown logic checks the actual contents of the connections, so if I signal 
from the `onTrigger` and initiate a flowController shutdown the generated 
flowFiles might not yet have been enqueued and do not trigger the graceful 
shutdown)




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


Reply via email to