()
| 58 | assert cls._loop is not None, "Loop is not started" |
| 59 | |
| 60 | async def wait_for_tasks(): |
| 61 | current_task = asyncio.current_task(cls._loop) |
| 62 | tasks = [ |
| 63 | task |
| 64 | for task in asyncio.all_tasks(cls._loop) |
| 65 | if not task.done() and task is not current_task |
| 66 | ] |
| 67 | cls._logger.info(f"Waiting for {len(tasks)} tasks to finish") |
| 68 | if tasks: |
| 69 | await asyncio.gather(*tasks) |
| 70 | |
| 71 | # Schedule the wait_for_tasks coroutine to be executed in the loop |
| 72 | future = asyncio.run_coroutine_threadsafe(wait_for_tasks(), cls._loop) |
nothing calls this directly
no outgoing calls
no test coverage detected