Skip to content

Commit 5af0268

Browse files
arlosiTurbo87
authored andcommitted
admin/delete_version: Use sync_to_git/sparse_index() jobs if FEATURE_INDEX_SYNC env var is set
This ensures that we not only remove the version from the database, but also from the index.
1 parent ef234a4 commit 5af0268

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/admin/delete_version.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use crate::background_jobs::Job;
12
use crate::{
23
admin::dialoguer,
34
db,
@@ -57,4 +58,11 @@ fn delete(opts: Opts, conn: &mut PgConnection) {
5758
if !opts.yes && !dialoguer::confirm("commit?") {
5859
panic!("aborting transaction");
5960
}
61+
62+
if dotenv::var("FEATURE_INDEX_SYNC").is_ok() {
63+
Job::sync_to_git_index(&krate.name).enqueue(conn).unwrap();
64+
Job::sync_to_sparse_index(&krate.name)
65+
.enqueue(conn)
66+
.unwrap();
67+
}
6068
}

0 commit comments

Comments
 (0)