mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-30 17:20:03 +00:00
Fix rate limit checking in GhApiClient
(#1725)
* Fix rate limit checking in `GhApiClient` - Mv logic into `binstalk_downloader` - Check for `RETRY_AFTER` and `x-ratelimit-remaining` on any status code Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix clippy lint Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> --------- Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
3aae883467
commit
238e0f6318
3 changed files with 40 additions and 43 deletions
|
@ -299,14 +299,13 @@ impl GhApiClient {
|
|||
.send(false)
|
||||
.await?;
|
||||
|
||||
match check_http_status_and_header(&response) {
|
||||
match check_http_status_and_header(response) {
|
||||
Err(GhApiError::Unauthorized) => {
|
||||
self.0.is_auth_token_valid.store(false, Relaxed);
|
||||
Err(GhApiError::Unauthorized)
|
||||
}
|
||||
res => res?,
|
||||
res => res.map(Download::from_response),
|
||||
}
|
||||
|
||||
Ok(Download::from_response(response))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue