Skip to content

Commit

Permalink
fix worker status command
Browse files Browse the repository at this point in the history
  • Loading branch information
Keksoj committed Nov 23, 2023
1 parent af17580 commit 0d82323
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/src/command/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
11 changes: 9 additions & 2 deletions bin/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down

0 comments on commit 0d82323

Please sign in to comment.