mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 22:30:03 +00:00
Fix too many 429 response (#1231)
Fixed #1229 Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
e4c776f403
commit
435df675b3
11 changed files with 228 additions and 132 deletions
|
@ -2,7 +2,7 @@ use std::{
|
|||
env,
|
||||
ffi::OsString,
|
||||
fmt,
|
||||
num::{NonZeroU64, ParseIntError},
|
||||
num::{NonZeroU16, NonZeroU64, ParseIntError},
|
||||
path::PathBuf,
|
||||
str::FromStr,
|
||||
};
|
||||
|
@ -348,7 +348,7 @@ impl From<TLSVersion> for remote::TLSVersion {
|
|||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct RateLimit {
|
||||
pub duration: NonZeroU64,
|
||||
pub duration: NonZeroU16,
|
||||
pub request_count: NonZeroU64,
|
||||
}
|
||||
|
||||
|
@ -379,7 +379,7 @@ impl FromStr for RateLimit {
|
|||
impl Default for RateLimit {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
duration: NonZeroU64::new(10).unwrap(),
|
||||
duration: NonZeroU16::new(10).unwrap(),
|
||||
request_count: NonZeroU64::new(1).unwrap(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ use std::{
|
|||
future::Future,
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use binstalk::{
|
||||
|
@ -100,7 +99,7 @@ pub fn install_crates(
|
|||
let client = Client::new(
|
||||
concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")),
|
||||
args.min_tls_version.map(|v| v.into()),
|
||||
Duration::from_millis(rate_limit.duration.get()),
|
||||
rate_limit.duration,
|
||||
rate_limit.request_count,
|
||||
read_root_certs(
|
||||
args.root_certificates,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue