Skip to content

Commit 92b8fac

Browse files
authored
admin/delete-crate: Use configurable 24 hour availability delay (#10015)
1 parent 1b416a4 commit 92b8fac

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/bin/crates-admin/delete_crate.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ pub struct Opts {
3838
/// An optional message explaining why the crate was deleted.
3939
#[arg(long)]
4040
message: Option<String>,
41+
42+
/// The amount of time (in hours) before making the crate available
43+
/// for re-registration.
44+
#[arg(long, default_value = "24")]
45+
availability_delay: i64,
4146
}
4247

4348
pub async fn run(opts: Opts) -> anyhow::Result<()> {
@@ -75,6 +80,7 @@ pub async fn run(opts: Opts) -> anyhow::Result<()> {
7580
}
7681

7782
let now = Utc::now();
83+
let available_at = now + chrono::TimeDelta::hours(opts.availability_delay);
7884

7985
for name in &crate_names {
8086
if let Some(crate_info) = existing_crates.iter().find(|info| info.name == *name) {
@@ -86,7 +92,7 @@ pub async fn run(opts: Opts) -> anyhow::Result<()> {
8692
.deleted_at(&now)
8793
.deleted_by(deleted_by.id)
8894
.maybe_message(opts.message.as_deref())
89-
.available_at(&now)
95+
.available_at(&available_at)
9096
.build();
9197

9298
info!("{name}: Deleting crate from the database…");

0 commit comments

Comments
 (0)