fgerlits commented on a change in pull request #1076:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1076#discussion_r648076693



##########
File path: docker/test/integration/minifi/core/FileSystemObserver.py
##########
@@ -31,16 +31,21 @@ def restart_observer_if_needed(self):
         self.observer.schedule(self.event_handler, self.test_output_dir, 
recursive=True)
         self.observer.start()
 
-    def wait_for_output(self, timeout_seconds, output_validator, max_files):
+    def wait_for_output(self, timeout_seconds, max_files):
         logging.info('Waiting up to %d seconds for %d test outputs...', 
timeout_seconds, max_files)
         self.restart_observer_if_needed()
+        if max_files <= self.event_handler.get_num_files_created():
+            return
         wait_start_time = time.perf_counter()
-        for i in range(0, max_files):
+        for _ in range(0, max_files):
             # Note: The timing on Event.wait() is inaccurate
-            self.done_event.wait(timeout_seconds)
-            self.done_event.clear()
-            current_time = time.perf_counter()
-            if timeout_seconds < (current_time - wait_start_time) or 
output_validator.validate():
+            self.done_event.wait(timeout_seconds - time.perf_counter() + 
wait_start_time)

Review comment:
       Sorry, I misread the code, I thought the `wait()` was a sleep, and it 
was always going to wait for `timeout_seconds`. Now I see it is waiting to be 
notified of a file system event. This is fine.




-- 
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:
[email protected]


Reply via email to