From f544cfa4443e7836f63476730cf4b7a09c4821a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Tue, 12 Sep 2023 15:19:45 +0200 Subject: [PATCH] Remove tasks and content file on the s3 --- index-scheduler/src/lib.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/index-scheduler/src/lib.rs b/index-scheduler/src/lib.rs index 582b87f8d..ce720eedb 100644 --- a/index-scheduler/src/lib.rs +++ b/index-scheduler/src/lib.rs @@ -721,12 +721,22 @@ impl IndexScheduler { let processed = inner.processing_tasks.read().processed_previously().clone(); log::info!("Deleting {} processed tasks", processed.len()); - for task in processed { - let node = format!("/tasks/task-{:0>10?}", task as i32); + for task_id in processed { + 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. .delete(&node, None) .unwrap(); + s3.delete_object(format!("tasks.{:0>10?}", task_id as u32)) + .unwrap(); // 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(); + } } } }