From 04dfa6d923ebd8c50df608b6040c96200f8d6cda Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 20 Dec 2024 16:45:57 +0000 Subject: [PATCH] azureblob,oracleobjectstorage,s3: quit multipart uploads if the context is cancelled Before this change the multipart uploads would continue retrying even if the context was cancelled. --- backend/azureblob/azureblob.go | 3 +++ backend/oracleobjectstorage/multipart.go | 4 ++++ backend/s3/s3.go | 3 +++ 3 files changed, 10 insertions(+) diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.go index c7e43ecb4..6b5cace0c 100644 --- a/backend/azureblob/azureblob.go +++ b/backend/azureblob/azureblob.go @@ -2162,6 +2162,9 @@ func (w *azChunkWriter) WriteChunk(ctx context.Context, chunkNumber int, reader if chunkNumber <= 8 { return w.f.shouldRetry(ctx, err) } + if fserrors.ContextError(ctx, &err) { + return false, err + } // retry all chunks once have done the first few return true, err } diff --git a/backend/oracleobjectstorage/multipart.go b/backend/oracleobjectstorage/multipart.go index c0d9d4600..d3f471b91 100644 --- a/backend/oracleobjectstorage/multipart.go +++ b/backend/oracleobjectstorage/multipart.go @@ -22,6 +22,7 @@ import ( "github.com/oracle/oci-go-sdk/v65/objectstorage" "github.com/rclone/rclone/fs" "github.com/rclone/rclone/fs/chunksize" + "github.com/rclone/rclone/fs/fserrors" "github.com/rclone/rclone/fs/hash" ) @@ -183,6 +184,9 @@ func (w *objectChunkWriter) WriteChunk(ctx context.Context, chunkNumber int, rea if ossPartNumber <= 8 { return shouldRetry(ctx, resp.HTTPResponse(), err) } + if fserrors.ContextError(ctx, &err) { + return false, err + } // retry all chunks once have done the first few return true, err } diff --git a/backend/s3/s3.go b/backend/s3/s3.go index b8a0acad7..a0eda19ab 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -6175,6 +6175,9 @@ func (w *s3ChunkWriter) WriteChunk(ctx context.Context, chunkNumber int, reader if chunkNumber <= 8 { return w.f.shouldRetry(ctx, err) } + if fserrors.ContextError(ctx, &err) { + return false, err + } // retry all chunks once have done the first few return true, err }