From ab6a1fac2e110d4b2a99df8fc336fa4e0dbe58b0 Mon Sep 17 00:00:00 2001 From: Samuel <39674930+sagoez@users.noreply.github.com> Date: Fri, 18 Oct 2024 15:25:06 +0100 Subject: [PATCH] chore: avoid connection creation on k8s resource creation failure (#179) --- integrationos-api/src/logic/connection.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/integrationos-api/src/logic/connection.rs b/integrationos-api/src/logic/connection.rs index c602da87..fefc9638 100644 --- a/integrationos-api/src/logic/connection.rs +++ b/integrationos-api/src/logic/connection.rs @@ -287,6 +287,10 @@ pub async fn create_connection( ) .await?; + if let (Some(service), Some(deployment)) = (service, deployment) { + state.k8s_client.coordinator(service, deployment).await?; + } + let connection = Connection { id: connection_id, platform_version: connection_config.clone().platform_version, @@ -321,11 +325,6 @@ pub async fn create_connection( error!("Error creating connection: {:?}", e); })?; - // We try to create the pod for database connections only after the connection is created - if let (Some(service), Some(deployment)) = (service, deployment) { - state.k8s_client.coordinator(service, deployment).await?; - } - Ok(Json(SanitizedConnection { id: connection.id, platform_version: connection.platform_version,