diff --git a/src/macros/backoff.rs b/src/macros/backoff.rs index 778ebce..f0dd6cc 100644 --- a/src/macros/backoff.rs +++ b/src/macros/backoff.rs @@ -30,6 +30,9 @@ macro_rules! with_exponential_backoff { { $crate::backoff!(backoff_secs, $ctx) } + Ok(response) if response.status() == kxio::net::StatusCode::TOO_MANY_REQUESTS => { + $crate::backoff!(backoff_secs, $ctx) + } result => break result, } } diff --git a/src/trello/client.rs b/src/trello/client.rs index cf25921..7483dfe 100644 --- a/src/trello/client.rs +++ b/src/trello/client.rs @@ -92,11 +92,10 @@ impl<'ctx> TrelloClient<'ctx> { .headers(self.auth_headers()) .header("accept", "application/octet") .send() - .await? - .bytes() .await - .map_err(Into::into) - ) + )? + .bytes() + .await .context("downloading attachment")?; let file = fs.file(&file_name); file.write(resp)