File tree Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -1086,17 +1086,25 @@ func (s *S3Backend) MultipartExpire(param *MultipartExpireInput) (*MultipartExpi
1086
1086
}
1087
1087
s3Log .Debug (mpu )
1088
1088
1089
+ now := time .Now ()
1089
1090
for _ , upload := range mpu .Uploads {
1090
- // FIXME: Maybe keep parts with known etags if we load them from disk
1091
- params := & s3.AbortMultipartUploadInput {
1092
- Bucket : & s .bucket ,
1093
- Key : upload .Key ,
1094
- UploadId : upload .UploadId ,
1095
- }
1096
- resp , err := s .AbortMultipartUpload (params )
1097
- s3Log .Debug (resp )
1098
- if mapAwsError (err ) == syscall .EACCES {
1099
- break
1091
+ expireTime := upload .Initiated .Add (48 * time .Hour )
1092
+
1093
+ if ! expireTime .After (now ) {
1094
+ // FIXME: Maybe keep parts with known etags if we load them from disk
1095
+ params := & s3.AbortMultipartUploadInput {
1096
+ Bucket : & s .bucket ,
1097
+ Key : upload .Key ,
1098
+ UploadId : upload .UploadId ,
1099
+ }
1100
+ resp , err := s .AbortMultipartUpload (params )
1101
+ s3Log .Debug (resp )
1102
+
1103
+ if mapAwsError (err ) == syscall .EACCES {
1104
+ break
1105
+ }
1106
+ } else {
1107
+ s3Log .Debugf ("Keeping MPU Key=%v Id=%v" , * upload .Key , * upload .UploadId )
1100
1108
}
1101
1109
}
1102
1110
You can’t perform that action at this time.
0 commit comments