Watch for and handle restart requests.
(self)
| 515 | await asyncio.sleep(0.2) |
| 516 | |
| 517 | async def watch_restarts(self) -> None: |
| 518 | """Watch for and handle restart requests.""" |
| 519 | while True: |
| 520 | if self.should_exit: |
| 521 | return |
| 522 | |
| 523 | try: |
| 524 | await asyncio.wait_for(self.restart_requested.wait(), timeout=0.1) |
| 525 | except asyncio.TimeoutError: |
| 526 | continue |
| 527 | |
| 528 | self.restart_requested.clear() |
| 529 | await self.shutdown() |
| 530 | await self.startup() |
| 531 | |
| 532 | def run(self, sockets: list[socket] | None = None) -> None: |
| 533 | """Run the server.""" |