mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-05 19:50:02 +00:00
Obey crates.io crawler policy: Only make one request per sec (#908)
Fixed https://github.com/taiki-e/install-action/issues/89 Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
f37796a55f
commit
d118fa8fdb
4 changed files with 47 additions and 1 deletions
|
@ -13,6 +13,7 @@ use crate::{
|
|||
remote::{Client, Url},
|
||||
},
|
||||
manifests::cargo_toml_binstall::{Meta, TarBasedFmt},
|
||||
ops::CratesIoRateLimit,
|
||||
};
|
||||
|
||||
mod vfs;
|
||||
|
@ -48,7 +49,11 @@ pub async fn fetch_crate_cratesio(
|
|||
client: Client,
|
||||
name: &str,
|
||||
version_req: &VersionReq,
|
||||
crates_io_rate_limit: &CratesIoRateLimit,
|
||||
) -> Result<Manifest<Meta>, BinstallError> {
|
||||
// Wait until we can make another request to crates.io
|
||||
crates_io_rate_limit.tick().await;
|
||||
|
||||
// Fetch / update index
|
||||
debug!("Looking up crate information");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue