diff --git a/bin/src/command/requests.rs b/bin/src/command/requests.rs index 10ec7bfd9..ee3ad175a 100644 --- a/bin/src/command/requests.rs +++ b/bin/src/command/requests.rs @@ -897,7 +897,7 @@ impl CommandServer { self.in_flight .insert(worker_request_id.clone(), (status_tx.clone(), 1)); } - worker_info_map.insert(worker_request_id, worker.info()); + worker_info_map.insert(worker_request_id, worker.querying_info()); } let command_tx = self.command_tx.clone(); diff --git a/bin/src/worker.rs b/bin/src/worker.rs index 55a5e6496..a6004286b 100644 --- a/bin/src/worker.rs +++ b/bin/src/worker.rs @@ -99,11 +99,18 @@ impl Worker { kill(Pid::from_raw(self.pid), None).is_ok() } - pub fn info(&self) -> WorkerInfo { + /// get info about a worker, with a NotAnswering run state by default, + /// to be updated when the worker responds + pub fn querying_info(&self) -> WorkerInfo { + let run_state = match self.run_state { + RunState::Stopping => RunState::Stopping, + RunState::Stopped => RunState::Stopped, + RunState::Running | RunState::NotAnswering => RunState::NotAnswering, + }; WorkerInfo { id: self.id, pid: self.pid, - run_state: self.run_state as i32, + run_state: run_state as i32, } }