Skip to content

worker/delete_crate: Delete OG images when deleting crates #11535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/worker/jobs/delete_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl BackgroundJob for DeleteCrateFromStorage {
let name = &self.name;
let feed_id = FeedId::Crate { name };

let (crate_file_paths, readme_paths, _) = try_join!(
let (crate_file_paths, readme_paths, _, _) = try_join!(
async {
info!("{name}: Deleting crate files from S3…");
let result = ctx.storage.delete_all_crate_files(name).await;
Expand All @@ -45,6 +45,11 @@ impl BackgroundJob for DeleteCrateFromStorage {
info!("{name}: Deleting RSS feed from S3…");
let result = ctx.storage.delete_feed(&feed_id).await;
result.context("Failed to delete RSS feed from S3")
},
async {
info!("{name}: Deleting OG image from S3…");
let result = ctx.storage.delete_og_image(name).await;
result.context("Failed to delete OG image from S3")
}
)?;

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