Skip to content

Commit

Permalink
Prune tags and metadata during obj/version delete
Browse files Browse the repository at this point in the history
  • Loading branch information
TimCsaky committed Sep 14, 2022
1 parent 7dc892f commit ea286d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 6 additions & 1 deletion app/src/controllers/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,10 @@ const controller = {
const objectVersionId = s3Response.VersionId;
// delete version in DB
await versionService.delete(objId, objectVersionId);
// prune tags amd metadata
await metadataService.pruneOrphanedMetadata();
await tagService.pruneOrphanedTags();
// if other versions in DB, delete object record
// TODO: synch with versions in S3
const remainingVersions = await versionService.list(objId);
if (remainingVersions.length === 0) await objectService.delete(objId);
} else { // else deleting the object
Expand All @@ -371,6 +373,9 @@ const controller = {
} else { // else object in bucket is not versioned
// delete object record from DB
await objectService.delete(objId);
// prune tags amd metadata
await metadataService.pruneOrphanedMetadata();
await tagService.pruneOrphanedTags();
}
}

Expand Down
2 changes: 0 additions & 2 deletions app/src/services/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ const service = {
.returning('*')
.throwIfNotFound();

// TODO: prune metadata and tags

if (!etrx) await trx.commit();
return Promise.resolve(response);
} catch (err) {
Expand Down

0 comments on commit ea286d1

Please sign in to comment.