mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-06-16 23:56:37 +00:00
Add retry on rate limit in unit testing
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
f92cd84fd0
commit
b5831b2137
1 changed files with 10 additions and 1 deletions
|
@ -551,7 +551,16 @@ mod test {
|
||||||
|
|
||||||
tests.push((
|
tests.push((
|
||||||
None,
|
None,
|
||||||
tokio::spawn(async move { client.get_repo_info(&repo).await }),
|
tokio::spawn(async move {
|
||||||
|
loop {
|
||||||
|
match client.get_repo_info(&repo).await {
|
||||||
|
Err(GhApiError::RateLimit { retry_after }) => {
|
||||||
|
sleep(retry_after.unwrap_or(DEFAULT_RETRY_AFTER)).await
|
||||||
|
}
|
||||||
|
res => break res,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue