[pbs-devel] [PATCH proxmox 2/3] s3-client: move exponential backoff to after the response state check
Christian Ebner
c.ebner at proxmox.com
Fri Jan 23 15:58:34 CET 2026
The exponential backup must only be performed after transient error
states anyways, so move it to the end of the loop, further avoiding
an unneeded retry counter check.
Since the put rate limiter remains in-place, this now also correctly
accounts for the additional exponential backoff time, already doing
some of the potential delay.
Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
proxmox-s3-client/src/client.rs | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/proxmox-s3-client/src/client.rs b/proxmox-s3-client/src/client.rs
index 5e30aa12..f3e5eb45 100644
--- a/proxmox-s3-client/src/client.rs
+++ b/proxmox-s3-client/src/client.rs
@@ -380,11 +380,6 @@ impl S3Client {
}
}
- if retry > 0 {
- let backoff_secs = S3_HTTP_REQUEST_RETRY_BACKOFF_DEFAULT * 3_u32.pow(retry as u32);
- tokio::time::sleep(backoff_secs).await;
- }
-
let response = if let Some(deadline) = deadline {
tokio::time::timeout_at(deadline, self.client.request(request))
.await
@@ -401,6 +396,9 @@ impl S3Client {
}
}
}
+
+ let backoff_secs = S3_HTTP_REQUEST_RETRY_BACKOFF_DEFAULT * 3_u32.pow(retry as u32);
+ tokio::time::sleep(backoff_secs).await;
}
bail!("failed to send request exceeding retries");
--
2.47.3
More information about the pbs-devel
mailing list