Skip to content

Commit dc1486b

Browse files
committed
Auto merge of #3544 - jtgeibel:rate-limiting, r=pietroalbini
More aggressively rate limit reserving new package names Larger burst limits can be applied on a per-user basis if they contact us ahead of time. r? `@pietroalbini`
2 parents b5f3440 + da125a6 commit dc1486b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/publish_rate_limit.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,19 @@ pub struct PublishRateLimit {
1414

1515
impl Default for PublishRateLimit {
1616
fn default() -> Self {
17+
let minutes = dotenv::var("WEB_NEW_PKG_RATE_LIMIT_RATE_MINUTES")
18+
.unwrap_or_default()
19+
.parse()
20+
.ok()
21+
.unwrap_or(10);
22+
let burst = dotenv::var("WEB_NEW_PKG_RATE_LIMIT_BURST")
23+
.unwrap_or_default()
24+
.parse()
25+
.ok()
26+
.unwrap_or(5);
1727
Self {
18-
rate: Duration::from_secs(60) * 10,
19-
burst: 30,
28+
rate: Duration::from_secs(60) * minutes,
29+
burst,
2030
}
2131
}
2232
}

0 commit comments

Comments
 (0)