From a8c2d77c91b8f7108e5cf3653b338924f49a17a6 Mon Sep 17 00:00:00 2001 From: Adam Hopkins Date: Sun, 26 Mar 2023 08:39:59 +0300 Subject: [PATCH] Sync state tolerance (#2725) --- sanic/worker/manager.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sanic/worker/manager.py b/sanic/worker/manager.py index b917a3e9..abdaa5cf 100644 --- a/sanic/worker/manager.py +++ b/sanic/worker/manager.py @@ -312,6 +312,10 @@ class WorkerManager: def _sync_states(self): for process in self.processes: - state = self.worker_state[process.name].get("state") + try: + state = self.worker_state[process.name].get("state") + except KeyError: + process.set_state(ProcessState.TERMINATED, True) + continue if state and process.state.name != state: process.set_state(ProcessState[state], True)