mirror of
https://github.com/rclone/rclone.git
synced 2025-01-09 15:58:28 +01:00
backend/s3: fix multipart abort context
S3 couldn't abort multi-part upload when context is canceled because canceled context prevents abort request from being sent.
This commit is contained in:
parent
7e2568a312
commit
708b967f15
@ -1799,8 +1799,9 @@ func (f *Fs) copyMultipart(ctx context.Context, req *s3.CopyObjectInput, dstBuck
|
|||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// We can try to abort the upload, but ignore the error.
|
// We can try to abort the upload, but ignore the error.
|
||||||
|
fs.Debugf(nil, "Cancelling multipart copy")
|
||||||
_ = f.pacer.Call(func() (bool, error) {
|
_ = f.pacer.Call(func() (bool, error) {
|
||||||
_, err := f.c.AbortMultipartUploadWithContext(ctx, &s3.AbortMultipartUploadInput{
|
_, err := f.c.AbortMultipartUploadWithContext(context.Background(), &s3.AbortMultipartUploadInput{
|
||||||
Bucket: &dstBucket,
|
Bucket: &dstBucket,
|
||||||
Key: &dstPath,
|
Key: &dstPath,
|
||||||
UploadId: uid,
|
UploadId: uid,
|
||||||
@ -2172,7 +2173,7 @@ func (o *Object) uploadMultipart(ctx context.Context, req *s3.PutObjectInput, si
|
|||||||
// We can try to abort the upload, but ignore the error.
|
// We can try to abort the upload, but ignore the error.
|
||||||
fs.Debugf(o, "Cancelling multipart upload")
|
fs.Debugf(o, "Cancelling multipart upload")
|
||||||
errCancel := f.pacer.Call(func() (bool, error) {
|
errCancel := f.pacer.Call(func() (bool, error) {
|
||||||
_, err := f.c.AbortMultipartUploadWithContext(ctx, &s3.AbortMultipartUploadInput{
|
_, err := f.c.AbortMultipartUploadWithContext(context.Background(), &s3.AbortMultipartUploadInput{
|
||||||
Bucket: req.Bucket,
|
Bucket: req.Bucket,
|
||||||
Key: req.Key,
|
Key: req.Key,
|
||||||
UploadId: uid,
|
UploadId: uid,
|
||||||
|
Loading…
Reference in New Issue
Block a user