From d3e0fbf73f93b3b31f660a00aa34926671f16c52 Mon Sep 17 00:00:00 2001 From: Nick Hudson Date: Thu, 26 Sep 2024 21:38:14 -0500 Subject: [PATCH] fix logic where we remove stalled backups --- tembo-operator/src/cloudnativepg/hibernate.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tembo-operator/src/cloudnativepg/hibernate.rs b/tembo-operator/src/cloudnativepg/hibernate.rs index 408fe54bd..28b8aa0dc 100644 --- a/tembo-operator/src/cloudnativepg/hibernate.rs +++ b/tembo-operator/src/cloudnativepg/hibernate.rs @@ -180,6 +180,10 @@ pub async fn reconcile_cluster_hibernation(cdb: &CoreDB, ctx: &Arc) -> name, hibernation_value ); if cdb.spec.stop { + // Only remove stalled backups if the instance is stopped/paused + info!("Remove any stalled backups for paused instance {}", name); + removed_stalled_backups(cdb, ctx).await?; + info!("Fully reconciled stopped instance {}", name); return Err(requeue_normal_with_jitter()); } @@ -204,9 +208,6 @@ pub async fn reconcile_cluster_hibernation(cdb: &CoreDB, ctx: &Arc) -> patch_cdb_status_merge(&coredbs, &name, patch_status).await?; if cdb.spec.stop { - // Only remove stalled backups if the instance is stopped/paused - info!("Remove any stalled backups for paused instance {}", name); - removed_stalled_backups(cdb, ctx).await?; info!("Fully reconciled stopped instance {}", name); return Err(requeue_normal_with_jitter()); }