Run the server until shutdown.
()
| 699 | self._shutdown_event = asyncio.Event() |
| 700 | |
| 701 | async def run_server(): |
| 702 | """Run the server until shutdown.""" |
| 703 | try: |
| 704 | await self._run_server() |
| 705 | except asyncio.CancelledError: |
| 706 | logger_debug("[server] Server task cancelled") |
| 707 | except Exception as e: |
| 708 | logger.error(f"Server error: {e}") |
| 709 | logger.error(traceback.format_exc()) |
| 710 | finally: |
| 711 | # Cancel all worker tasks |
| 712 | for task in self._worker_tasks: |
| 713 | if not task.done(): |
| 714 | task.cancel() |
| 715 | # Wait for all tasks to complete |
| 716 | if self._worker_tasks: |
| 717 | await asyncio.gather(*self._worker_tasks, |
| 718 | return_exceptions=True) |
| 719 | |
| 720 | # Drain any remaining requests and send cancellation responses |
| 721 | await self._drain_pending_requests() |
| 722 | |
| 723 | logger_debug("[server] All server tasks completed") |
| 724 | |
| 725 | self._main_task = self._loop.create_task(run_server()) |
| 726 |
nothing calls this directly
no test coverage detected