[pbs-devel] [PATCH proxmox v3 1/2] s3-client: add exponential backoff time for upload retries

Christian Ebner c.ebner at proxmox.com
Wed Oct 15 18:39:59 CEST 2025


With the main purpose to backoff some time in case of concurrent
conditional uploads with the If-None-Match header is set. For these,
the upload will fail with http status code 409 as stated in  [0]. The
backoff time will increase the time window for the already ongoing
upload to finish.

[0] https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html#API_PutObject_RequestSyntax

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
 proxmox-s3-client/src/client.rs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/proxmox-s3-client/src/client.rs b/proxmox-s3-client/src/client.rs
index abb35f2f..4ebd8c4b 100644
--- a/proxmox-s3-client/src/client.rs
+++ b/proxmox-s3-client/src/client.rs
@@ -715,6 +715,10 @@ impl S3Client {
             .max(S3_HTTP_REQUEST_TIMEOUT.as_secs());
         let timeout = Some(Duration::from_secs(timeout_secs));
         for retry in 0..MAX_S3_UPLOAD_RETRY {
+            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 body = Body::from(object_data.clone());
             match self
                 .put_object(object_key.clone(), body, timeout, replace)
-- 
2.47.3





More information about the pbs-devel mailing list