Skip to content

Commit

Permalink
Do not stop orphan cleanup script when datasource do not exists (#9383)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraggle authored Dec 14, 2024
1 parent 6a37ec8 commit b9d650b
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions core/bin/qdrant/delete_orphaned_points.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,27 +66,38 @@ async fn delete_orphaned_points_for_data_source(

let ds = store
.load_data_source_by_internal_id(data_source_internal_id)
.await?
.ok_or_else(|| anyhow!("data source not found"))?;

let qdrant_client = ds.main_qdrant_client(qdrant_clients);
.await?;

for document_id in document_ids {
if let Err(e) =
delete_orphaned_points_for_document_id(store, &ds, &qdrant_client, document_id).await
{
match ds {
Some(ds) => {
let qdrant_client = ds.main_qdrant_client(qdrant_clients);

for document_id in document_ids {
if let Err(e) =
delete_orphaned_points_for_document_id(store, &ds, &qdrant_client, document_id)
.await
{
eprintln!(
"error deleting point for document_id: {} in data_source_internal_id: {}: {}",
document_id, data_source_internal_id, e
);
}
}

println!(
"finished processing data_source_internal_id: {}",
data_source_internal_id
);
return Ok(());
}
None => {
eprintln!(
"error deleting point for document_id: {} in data_source_internal_id: {}: {}",
document_id, data_source_internal_id, e
"data source not found for data_source_internal_id: {}",
data_source_internal_id
);
return Ok(());
}
}

println!(
"finished processing data_source_internal_id: {}",
data_source_internal_id
);
Ok(())
}

#[tokio::main]
Expand Down

0 comments on commit b9d650b

Please sign in to comment.