Remove tasks and content file on the s3

This commit is contained in:
Clément Renault 2023-09-12 15:19:45 +02:00
parent c158d03337
commit f544cfa444
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F

View File

@ -721,12 +721,22 @@ impl IndexScheduler {
let processed = let processed =
inner.processing_tasks.read().processed_previously().clone(); inner.processing_tasks.read().processed_previously().clone();
log::info!("Deleting {} processed tasks", processed.len()); log::info!("Deleting {} processed tasks", processed.len());
for task in processed { for task_id in processed {
let node = format!("/tasks/task-{:0>10?}", task as i32); let node = format!("/tasks/task-{:0>10?}", task_id as i32);
let _ = zookeeper // we don't want to crash if we can't delete an update file. let _ = zookeeper // we don't want to crash if we can't delete an update file.
.delete(&node, None) .delete(&node, None)
.unwrap(); .unwrap();
s3.delete_object(format!("tasks.{:0>10?}", task_id as u32))
.unwrap();
// TODO: Delete the update files associated with the deleted tasks // TODO: Delete the update files associated with the deleted tasks
if let Some(content_uuid) = inner
.get_task(&rtxn, task_id)
.unwrap()
.and_then(|t| t.content_uuid())
{
s3.delete_object(format!("/update-files/{content_uuid}"))
.unwrap();
}
} }
} }
} }