From 0ff10d6ba456e35daf2d3e5ec3d57a122ddcb90c Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Wed, 4 Sep 2024 13:01:35 -0700 Subject: [PATCH] handle `Option` in update saga too (oops) --- nexus/src/app/sagas/instance_update/mod.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/nexus/src/app/sagas/instance_update/mod.rs b/nexus/src/app/sagas/instance_update/mod.rs index 16ee05d69c9..b580986b026 100644 --- a/nexus/src/app/sagas/instance_update/mod.rs +++ b/nexus/src/app/sagas/instance_update/mod.rs @@ -490,7 +490,7 @@ struct UpdatesRequired { /// The instance's auto-restart policy. This indicates whether the /// `instance-reincarnation` background task should be activated if the /// instance has transitioned to [`InstanceState::Failed`]. - auto_restart_policy: InstanceAutoRestart, + auto_restart_policy: Option, } #[derive(Debug, Deserialize, Serialize)] @@ -1218,15 +1218,17 @@ async fn siu_commit_instance_updates( // update saga is required, and the instance's auto-restart policy allows it // to be automatically restarted, activate the instance-reincarnation // background task to automatically restart it. - if update.new_runtime.can_reincarnate(update.auto_restart_policy) { - info!( - log, - "instance update: instance transitioned to Failed, but can \ - be automatically restarted; activating reincarnation."; - "instance_id" => %instance_id, - "auto_restart_policy" => ?update.auto_restart_policy, - ); - nexus.background_tasks.task_instance_reincarnation.activate(); + if let Some(auto_restart_policy) = update.auto_restart_policy { + if update.new_runtime.can_reincarnate(auto_restart_policy) { + info!( + log, + "instance update: instance transitioned to Failed, but can \ + be automatically restarted; activating reincarnation."; + "instance_id" => %instance_id, + "auto_restart_policy" => ?update.auto_restart_policy, + ); + nexus.background_tasks.task_instance_reincarnation.activate(); + } } Ok(())