Skip to content

Commit 3699b4e

Browse files
authored
Merge pull request #5487 from rtfd/search-delete-objects
Fix bug that caused search objects not to delete
2 parents e0c3e30 + 3d75dc3 commit 3699b4e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

readthedocs/projects/tasks.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1324,10 +1324,12 @@ def _manage_imported_files(version, path, commit):
13241324
)
13251325
# Keep the objects into memory to send it to signal
13261326
instance_list = list(delete_queryset)
1327-
# Safely delete from database
1328-
delete_queryset.delete()
13291327
# Always pass the list of instance, not queryset.
1328+
# These objects must exist though,
1329+
# because the task will query the DB for the objects before deleting
13301330
bulk_post_delete.send(sender=HTMLFile, instance_list=instance_list)
1331+
# Safely delete from database
1332+
delete_queryset.delete()
13311333

13321334
# Delete ImportedFiles from previous versions
13331335
(

0 commit comments

Comments
 (0)