Skip to content

Commit

Permalink
Even better optimize
Browse files Browse the repository at this point in the history
Issue: CLDSRV-570
  • Loading branch information
KillianG committed Nov 18, 2024
1 parent e9ae9c2 commit c7c7ba1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/api/apiUtils/object/abortMultipartUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ function abortMultipartUpload(authInfo, bucketName, objectKey, uploadId, log,
bucketName,
objectKey,
uploadId,
versionId: objectMD.versionId
versionId: objectMD.versionId,
});
return metadata.deleteObjectMD(bucketName, objectKey, { versionId: objectMD.versionId }, log, err => {
if (err) {
Expand All @@ -125,11 +125,10 @@ function abortMultipartUpload(authInfo, bucketName, objectKey, uploadId, log,
return next(null, mpuBucket, storedParts, destBucket);
}

const existingLocations = new Set(locations.map(loc => loc.key));

if (objectMD?.location) {
const existingLocations = new Set(locations.map(loc => loc.key));
const remainingObjectLocations = objectMD.location.filter(loc => !existingLocations.has(loc.key));
locations = [...locations, ...remainingObjectLocations];
locations.push(...remainingObjectLocations);
}

return async.eachLimit(locations, 5, (loc, cb) => {
Expand Down

0 comments on commit c7c7ba1

Please sign in to comment.