fix(trello): detect trello 429 responses correctly
Some checks failed
Test / build (map[name:nightly]) (push) Successful in 4m13s
Test / build (map[name:stable]) (push) Successful in 4m8s
Release Please / Release-plz (push) Failing after 32s

This commit is contained in:
Paul Campbell 2024-12-23 08:24:14 +00:00
parent 20fbce0cf0
commit 2dac4374f3
2 changed files with 6 additions and 4 deletions

View file

@ -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,
} }
} }

View file

@ -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)