Skip to content

Commit

Permalink
admin/delete_version: Use sync_to_git/sparse_index() jobs if `FEATU…
Browse files Browse the repository at this point in the history
…RE_INDEX_SYNC` env var is set

This ensures that we not only remove the version from the database, but also from the index.
  • Loading branch information
arlosi authored and Turbo87 committed Apr 21, 2023
1 parent ef234a4 commit 5af0268
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/admin/delete_version.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::background_jobs::Job;
use crate::{
admin::dialoguer,
db,
Expand Down Expand Up @@ -57,4 +58,11 @@ fn delete(opts: Opts, conn: &mut PgConnection) {
if !opts.yes && !dialoguer::confirm("commit?") {
panic!("aborting transaction");
}

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();
}
}

0 comments on commit 5af0268

Please sign in to comment.