oracleobjectstorage: fix accounting for multpart uploads

This commit is contained in:
Nick Craig-Wood 2023-08-24 17:15:04 +01:00
parent d69cdb79f7
commit f2467d07aa

View File

@ -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 {