fix(trello): detect trello 429 responses correctly
This commit is contained in:
parent
20fbce0cf0
commit
2dac4374f3
2 changed files with 6 additions and 4 deletions
|
@ -30,6 +30,9 @@ macro_rules! with_exponential_backoff {
|
||||||
{
|
{
|
||||||
$crate::backoff!(backoff_secs, $ctx)
|
$crate::backoff!(backoff_secs, $ctx)
|
||||||
}
|
}
|
||||||
|
Ok(response) if response.status() == kxio::net::StatusCode::TOO_MANY_REQUESTS => {
|
||||||
|
$crate::backoff!(backoff_secs, $ctx)
|
||||||
|
}
|
||||||
result => break result,
|
result => break result,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,11 +92,10 @@ impl<'ctx> TrelloClient<'ctx> {
|
||||||
.headers(self.auth_headers())
|
.headers(self.auth_headers())
|
||||||
.header("accept", "application/octet")
|
.header("accept", "application/octet")
|
||||||
.send()
|
.send()
|
||||||
.await?
|
|
||||||
.bytes()
|
|
||||||
.await
|
.await
|
||||||
.map_err(Into::into)
|
)?
|
||||||
)
|
.bytes()
|
||||||
|
.await
|
||||||
.context("downloading attachment")?;
|
.context("downloading attachment")?;
|
||||||
let file = fs.file(&file_name);
|
let file = fs.file(&file_name);
|
||||||
file.write(resp)
|
file.write(resp)
|
||||||
|
|
Loading…
Reference in a new issue