diff --git a/rtcbot/base/thread.py b/rtcbot/base/thread.py index 92ffbcc..4a101f7 100644 --- a/rtcbot/base/thread.py +++ b/rtcbot/base/thread.py @@ -44,8 +44,9 @@ def _producer(self): while not self._shouldClose: # In real code, there should be a timeout in get to make sure _shouldClose is not True try: - self._put_nowait(self.testQueue.get(1)) - except TimeoutError: + # WTF: why does timeout not work here? + self._put_nowait(self.testQueue.get(timeout=3)) + except queue.Empty: pass self.testResultQueue.put("<>") self._setReady(False) diff --git a/tests/test_base.py b/tests/test_base.py index 11dc96c..8e63169 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -148,13 +148,13 @@ async def test_ThreadedProducer(self): def pushsleep(): # Work around the lack of a timeout in testing p - time.sleep(1) + time.sleep(5) p.testQueue.put("Ending") threading.Thread(target=pushsleep).run() p.close() - await asyncio.sleep(0.01) + await asyncio.sleep(0.1) self.assertEqual(p.ready, False)