1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add timeouts in stream tests to prevent possible hangs (#47545)

* Add timeouts on recving packets

Add a timeout when recving packets from the worker thread in case it hangs.
Add an exit condition just in case the while loop goes on forever.

* Add a timeout to recorder thread join.

* Wait for recorder thread to be invoked in tests

Remove the while loop and instead wait for segments to be produced by the background worker thread.

* Allow worker to resume before stopping to fix timeouts

* Lower test timeout further

* Remove test_stream_ended since it is flaky

This test doesn't really add additional value on top of other tests.
This commit is contained in:
Allen Porter
2021-03-13 01:53:26 -08:00
committed by GitHub
parent 30f99177c7
commit 02a82d3f00
3 changed files with 31 additions and 55 deletions

View File

@@ -32,6 +32,7 @@ class WorkerSync:
def resume(self):
"""Allow the worker thread to finalize the stream."""
logging.debug("waking blocked worker")
self._event.set()
def blocking_finish(self, stream: Stream):