Periodically check worker health and manage pool.
(self)
| 381 | await self.stop() |
| 382 | |
| 383 | async def _worker_monitor(self): |
| 384 | """Periodically check worker health and manage pool.""" |
| 385 | while self.alive: |
| 386 | await asyncio.sleep(1.0) |
| 387 | |
| 388 | # Check if parent (main arbiter) died unexpectedly |
| 389 | if os.getppid() != self.ppid: |
| 390 | self.log.warning("Parent changed, shutting down dirty arbiter") |
| 391 | self.alive = False |
| 392 | self._shutdown() |
| 393 | return |
| 394 | |
| 395 | await self.murder_workers() |
| 396 | await self.manage_workers() |
| 397 | |
| 398 | async def _handle_sigchld(self): |
| 399 | """Handle SIGCHLD - reap dead workers.""" |