Skip to content

Commit

Permalink
chore: avoid connection creation on k8s resource creation failure (pi…
Browse files Browse the repository at this point in the history
  • Loading branch information
sagojez authored Oct 18, 2024
1 parent 913b114 commit ab6a1fa
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions integrationos-api/src/logic/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit ab6a1fa

Please sign in to comment.