Reload workers (SIGHUP handling).
(self)
| 1089 | raise |
| 1090 | |
| 1091 | async def reload(self): |
| 1092 | """Reload workers (SIGHUP handling).""" |
| 1093 | self.log.info("Reloading dirty workers") |
| 1094 | |
| 1095 | # Spawn new workers |
| 1096 | for _ in range(self.cfg.dirty_workers): |
| 1097 | self.spawn_worker() |
| 1098 | await asyncio.sleep(0.1) |
| 1099 | |
| 1100 | # Kill old workers |
| 1101 | old_workers = list(self.workers.keys()) |
| 1102 | for pid in old_workers[self.cfg.dirty_workers:]: |
| 1103 | self.kill_worker(pid, signal.SIGTERM) |
| 1104 | |
| 1105 | async def stop(self, graceful=True): |
| 1106 | """Stop all workers.""" |