Skip to content

Commit

Permalink
Merge branch 'branches/rudder/8.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
amousset committed Oct 28, 2024
2 parents f602c33 + 8a8ae99 commit c619844
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions policies/module-types/system-updates/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,20 @@ impl Runner {
}
}

fn update_one_step(
&mut self,
state: Option<UpdateStatus>,
) -> Result<(Continuation, UpdateStatus)> {
fn update_one_step(&mut self, state: Option<UpdateStatus>) -> Result<Continuation> {
let maybe_action = self.decide(state)?;
match maybe_action {
None => Ok((Continuation::Stop(Outcome::Success(None)), state.unwrap())),
None => Ok(Continuation::Stop(Outcome::Success(None))),
Some(action) => {
// TODO add method to handle dead process
let current_pid = self.db.lock(self.pid, &self.parameters.event_id)?;
if current_pid.is_some() {
// Could not acquire lock => no action
return Ok((Continuation::Stop(Outcome::Success(None)), state.unwrap()));
return Ok(Continuation::Stop(Outcome::Success(None)));
}
let cont = self.execute(action)?;
self.db.unlock(&self.parameters.event_id)?;
let new_state = self.db.get_status(&self.parameters.event_id)?;
Ok((cont, new_state.unwrap()))
Ok(cont)
}
}
}
Expand Down Expand Up @@ -142,8 +138,8 @@ impl Runner {
let status = self.db.get_status(&self.parameters.event_id)?;
let res = self.update_one_step(status);
match res {
Ok((Continuation::Continue, _)) => {}
Ok((Continuation::Stop(o), _)) => {
Ok(Continuation::Continue) => {}
Ok(Continuation::Stop(o)) => {
return Ok(o);
}
Err(e) => {
Expand Down

0 comments on commit c619844

Please sign in to comment.