Skip to content

Commit

Permalink
components: use teardown for draft cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kpsherva committed Nov 3, 2023
1 parent 4eb9911 commit ff6951e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions invenio_drafts_resources/services/records/components/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,7 @@ def _purge_bucket_and_ovs(self, files):
if files.bucket:
if files.bucket.locked:
files.unlock()
if files.enabled:
files.delete_all(softdelete_obj=False, remove_rf=True)
files.remove_bucket(force=True)
files.teardown(full=True)

def _publish_new(self, identity, draft, record):
"""Action when publishing a new draft."""
Expand All @@ -213,7 +211,7 @@ def _publish_new(self, identity, draft, record):
# Cleanup
if draft_files.enabled:
# Hard delete all draft file records but keep the object versions
draft_files.delete_all(remove_obj=False, remove_rf=True)
draft_files.teardown(full=False)
draft_files.unset_bucket()

def _publish_edit(self, identity, draft, record):
Expand Down

0 comments on commit ff6951e

Please sign in to comment.