()
| 1809 | |
| 1810 | # Give tasks a brief moment to acknowledge cancellation |
| 1811 | async def wait_for_cancellation(): |
| 1812 | try: |
| 1813 | await asyncio.wait_for( |
| 1814 | asyncio.gather(*tasks, return_exceptions=True), |
| 1815 | timeout=3.0, |
| 1816 | ) |
| 1817 | except asyncio.TimeoutError: |
| 1818 | logger.warning( |
| 1819 | "[ID-03] Timeout waiting for tasks to cancel." |
| 1820 | ) |
| 1821 | |
| 1822 | loop.create_task(wait_for_cancellation()) |
| 1823 | except Exception as e: |
no test coverage detected