From f2467d07aa8537469e186c407461173f852ac385 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 24 Aug 2023 17:15:04 +0100 Subject: [PATCH] oracleobjectstorage: fix accounting for multpart uploads --- backend/oracleobjectstorage/multipart.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backend/oracleobjectstorage/multipart.go b/backend/oracleobjectstorage/multipart.go index f5af23a11..615032ed2 100644 --- a/backend/oracleobjectstorage/multipart.go +++ b/backend/oracleobjectstorage/multipart.go @@ -16,6 +16,7 @@ import ( "github.com/ncw/swift/v2" "github.com/rclone/rclone/lib/multipart" + "github.com/rclone/rclone/lib/pool" "golang.org/x/net/http/httpguts" "github.com/oracle/oci-go-sdk/v65/common" @@ -128,6 +129,12 @@ func (w *objectChunkWriter) WriteChunk(ctx context.Context, chunkNumber int, rea err := fmt.Errorf("invalid chunk number provided: %v", chunkNumber) return -1, err } + // Only account after the checksum reads have been done + if do, ok := reader.(pool.DelayAccountinger); ok { + // To figure out this number, do a transfer and if the accounted size is 0 or a + // multiple of what it should be, increase or decrease this number. + do.DelayAccounting(2) + } m := md5.New() currentChunkSize, err := io.Copy(m, reader) if err != nil {