Skip to content

Commit

Permalink
Raise crate deletion download limit (#10266)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Turbo87 authored Dec 30, 2024
1 parent b382293 commit c50c66b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/templates/crate/delete.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<li>
<ul>
<li>the crate only has a single owner, and</li>
<li>the crate has been downloaded less than 100 times for each month it has been published, and</li>
<li>the crate has been downloaded less than 500 times for each month it has been published, and</li>
<li>the crate is not depended upon by any other crate on crates.io.</li>
</ul>
</li>
Expand Down
6 changes: 3 additions & 3 deletions src/controllers/krate/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use diesel_async::{AsyncConnection, AsyncPgConnection, RunQueryDsl};
use http::request::Parts;
use http::StatusCode;

const DOWNLOADS_PER_MONTH_LIMIT: u64 = 100;
const DOWNLOADS_PER_MONTH_LIMIT: u64 = 500;
const AVAILABLE_AFTER: TimeDelta = TimeDelta::hours(24);

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

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ snapshot_kind: text
},
"/api/v1/crates/{name}": {
"delete": {
"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.",
"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.",
"operationId": "delete_crate",
"parameters": [
{
Expand Down

0 comments on commit c50c66b

Please sign in to comment.