diff --git a/src/admin/delete_crate.rs b/src/admin/delete_crate.rs index 10571ae6c63..203fe7ba962 100644 --- a/src/admin/delete_crate.rs +++ b/src/admin/delete_crate.rs @@ -1,3 +1,4 @@ +use crate::background_jobs::Job; use crate::{admin::dialoguer, config, db, models::Crate, schema::crates}; use diesel::prelude::*; @@ -54,5 +55,12 @@ fn delete(opts: Opts, conn: &mut PgConnection) { panic!("aborting transaction"); } - uploader.delete_index(&client, &krate.name).unwrap(); + if dotenv::var("FEATURE_INDEX_SYNC").is_ok() { + Job::sync_to_git_index(&krate.name).enqueue(conn).unwrap(); + Job::sync_to_sparse_index(&krate.name) + .enqueue(conn) + .unwrap(); + } else { + uploader.delete_index(&client, &krate.name).unwrap(); + } }