Skip to content

Commit

Permalink
disallow any transition from successful/failed
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Guzik <[email protected]>
  • Loading branch information
Bravo555 committed Aug 8, 2024
1 parent 02ad60f commit 4f1f11b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/extensions/c8y_mapper_ext/src/operations/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,13 @@ struct RunningOperation {
fn is_operation_status_transition_valid(previous: &str, next: &str) -> bool {
#[allow(clippy::match_like_matches_macro)]
match (previous, next) {
("successful", "executing") => false,
("failed", "executing") => false,
// not really a transition but true for simplicity
(prev, next) if prev == next => true,

// successful and failed are terminal, can't change them
("successful", _) => false,
("failed", _) => false,

_ => true,
}
}
Expand Down

0 comments on commit 4f1f11b

Please sign in to comment.