Skip to content

Commit c50c66b

Browse files
authored
Raise crate deletion download limit (#10266)
As discussed in the last crates.io team meeting the current limit of just 100 downloads per month was too conservative. This commit raises the limit to 500 downloads per month to make self-service deletions a bit more viable in practice.
1 parent b382293 commit c50c66b

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

app/templates/crate/delete.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<li>
2727
<ul>
2828
<li>the crate only has a single owner, and</li>
29-
<li>the crate has been downloaded less than 100 times for each month it has been published, and</li>
29+
<li>the crate has been downloaded less than 500 times for each month it has been published, and</li>
3030
<li>the crate is not depended upon by any other crate on crates.io.</li>
3131
</ul>
3232
</li>

src/controllers/krate/delete.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use diesel_async::{AsyncConnection, AsyncPgConnection, RunQueryDsl};
1515
use http::request::Parts;
1616
use http::StatusCode;
1717

18-
const DOWNLOADS_PER_MONTH_LIMIT: u64 = 100;
18+
const DOWNLOADS_PER_MONTH_LIMIT: u64 = 500;
1919
const AVAILABLE_AFTER: TimeDelta = TimeDelta::hours(24);
2020

2121
/// Delete a crate.
@@ -25,7 +25,7 @@ const AVAILABLE_AFTER: TimeDelta = TimeDelta::hours(24);
2525
///
2626
/// The crate can only be deleted by the owner of the crate, and only if the
2727
/// crate has been published for less than 72 hours, or if the crate has a
28-
/// single owner, has been downloaded less than 100 times for each month it has
28+
/// single owner, has been downloaded less than 500 times for each month it has
2929
/// been published, and is not depended upon by any other crate on crates.io.
3030
#[utoipa::path(
3131
delete,
@@ -385,7 +385,7 @@ mod tests {
385385

386386
let response = delete_crate(&user, "foo").await;
387387
assert_eq!(response.status(), StatusCode::UNPROCESSABLE_ENTITY);
388-
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"only crates with less than 100 downloads per month can be deleted after 72 hours"}]}"#);
388+
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"only crates with less than 500 downloads per month can be deleted after 72 hours"}]}"#);
389389

390390
assert_crate_exists(&anon, "foo", true).await;
391391

src/snapshots/crates_io__openapi__tests__openapi_snapshot.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ snapshot_kind: text
482482
},
483483
"/api/v1/crates/{name}": {
484484
"delete": {
485-
"description": "The crate is immediately deleted from the database, and with a small delay\nfrom the git and sparse index, and the crate file storage.\n\nThe crate can only be deleted by the owner of the crate, and only if the\ncrate has been published for less than 72 hours, or if the crate has a\nsingle owner, has been downloaded less than 100 times for each month it has\nbeen published, and is not depended upon by any other crate on crates.io.",
485+
"description": "The crate is immediately deleted from the database, and with a small delay\nfrom the git and sparse index, and the crate file storage.\n\nThe crate can only be deleted by the owner of the crate, and only if the\ncrate has been published for less than 72 hours, or if the crate has a\nsingle owner, has been downloaded less than 500 times for each month it has\nbeen published, and is not depended upon by any other crate on crates.io.",
486486
"operationId": "delete_crate",
487487
"parameters": [
488488
{

0 commit comments

Comments
 (0)