Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.

Commit

Permalink
Add poll interval to avoid high CPU usage.
Browse files Browse the repository at this point in the history
Change-Id: Ic41285795521a6b5d45ad9b8a29a15cdcdb7db9f
  • Loading branch information
dmitriykovalev committed Nov 14, 2018
1 parent 3f27f66 commit f61bb68
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/tests/vision_examples_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ def example_path(name):
p = os.path.join(os.path.dirname(__file__), '..', 'examples', 'vision', name)
return os.path.abspath(p)

def wait_terminated(process, timeout):
def wait_terminated(process, timeout, poll_interval=1.0):
start = time.monotonic()
while time.monotonic() - start < timeout:
code = process.poll()
if code is not None:
return code
time.sleep(poll_interval)
return None

class VisionExamplesTest(unittest.TestCase):
Expand Down

0 comments on commit f61bb68

Please sign in to comment.