Skip to content

Commit

Permalink
remove watch from delete functions
Browse files Browse the repository at this point in the history
  • Loading branch information
nhudson committed Feb 1, 2024
1 parent 3f1b833 commit 0825b39
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions conductor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,25 +142,6 @@ pub async fn delete(client: Client, namespace: &str, name: &str) -> Result<(), C
.await
.map_err(ConductorError::KubeError);

// Watch for deletion
let wp = WatchParams {
field_selector: Some(format!("metadata.name={}", name)),
..WatchParams::default()
};
let stream = coredb_api
.watch(&wp, "0")
.await
.map_err(ConductorError::KubeError)?;

let mut pinned_stream = Box::pin(stream);

while let Some(status) = pinned_stream.try_next().await? {
if let WatchEvent::Deleted(_) = status {
info!("CoreDB {} deleted", name);
return Ok(());
}
}

Ok(())
}

Expand Down Expand Up @@ -211,24 +192,6 @@ pub async fn delete_namespace(client: Client, name: &str) -> Result<(), Conducto
.await
.map_err(ConductorError::KubeError);

// Watch for deletion
let wp = WatchParams {
field_selector: Some(format!("metadata.name={}", name)),
..WatchParams::default()
};
let stream = ns_api
.watch(&wp, "0")
.await
.map_err(ConductorError::KubeError)?;

let mut pinned_stream = Box::pin(stream);

while let Some(status) = pinned_stream.try_next().await? {
if let WatchEvent::Deleted(_) = status {
info!("Namespace {} deleted", name);
return Ok(());
}
}
Ok(())
}

Expand Down

0 comments on commit 0825b39

Please sign in to comment.