job: Fix job state update

Previously, if `old_state == new_state` the job metadata wasn't reinserted.
Just `get_mut` instead of removing and reinserting.
This commit is contained in:
Zhaofeng Li 2022-10-09 15:26:37 -06:00
parent 513ffd1f12
commit bf95e2dce8

View file

@ -367,7 +367,7 @@ impl JobMonitor {
message: Option<String>,
noop: bool,
) {
let mut metadata = self.jobs.remove(&job_id).unwrap();
let mut metadata = self.jobs.get_mut(&job_id).unwrap();
let old_state = metadata.state;
if old_state == new_state {
@ -407,8 +407,6 @@ impl JobMonitor {
}
}
};
self.jobs.insert(job_id, metadata);
}
/// Updates the user-visible job statistics output.