Skip to content

Commit a7d82d7

Browse files
committed
Fix bug that caused search objects not to delete
The comment mostly explains it, but the delete objects code does another query: https://github.com/rtfd/readthedocs.org/blob/3340364802a8cdcc5f4145fbde2a5dd4f7087771/readthedocs/search/tasks.py#L59-L62 This should now fix search deletion.
1 parent 3340364 commit a7d82d7

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)