Skip to content

Commit ede6512

Browse files
authored
worker/delete_crate: Delete OG images when deleting crates (#11535)
1 parent 6ed5e7b commit ede6512

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/worker/jobs/delete_crate.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl BackgroundJob for DeleteCrateFromStorage {
3030
let name = &self.name;
3131
let feed_id = FeedId::Crate { name };
3232

33-
let (crate_file_paths, readme_paths, _) = try_join!(
33+
let (crate_file_paths, readme_paths, _, _) = try_join!(
3434
async {
3535
info!("{name}: Deleting crate files from S3…");
3636
let result = ctx.storage.delete_all_crate_files(name).await;
@@ -45,6 +45,11 @@ impl BackgroundJob for DeleteCrateFromStorage {
4545
info!("{name}: Deleting RSS feed from S3…");
4646
let result = ctx.storage.delete_feed(&feed_id).await;
4747
result.context("Failed to delete RSS feed from S3")
48+
},
49+
async {
50+
info!("{name}: Deleting OG image from S3…");
51+
let result = ctx.storage.delete_og_image(name).await;
52+
result.context("Failed to delete OG image from S3")
4853
}
4954
)?;
5055

@@ -57,6 +62,7 @@ impl BackgroundJob for DeleteCrateFromStorage {
5762
crate_file_paths
5863
.into_iter()
5964
.chain(readme_paths.into_iter())
65+
.chain(std::iter::once(format!("og-images/{name}.png").into()))
6066
.chain(std::iter::once(object_store::path::Path::from(&feed_id))),
6167
)
6268
.enqueue(&mut conn)

0 commit comments

Comments
 (0)