Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 1b1b826

Browse files
committed
Make delete confirmation more lightweight
This nulls out the `get_deleted_objects`, which is used by the django admin to display a list of objects, and more importantly related objects being deleted. As in particular with big owners/repos, actually building the list of all the related objects is unreasonably slow, so slow in fact that showing the confirmation dialog times out. To not block deletes of deeply nested object hierarchies, this will just return empty lists instead.
1 parent c2edbb3 commit 1b1b826

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

codecov_auth/admin.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -645,18 +645,7 @@ def delete_model(self, request, obj) -> None:
645645
TaskService().delete_owner(ownerid=obj.ownerid)
646646

647647
def get_deleted_objects(self, objs, request):
648-
(
649-
deleted_objects,
650-
model_count,
651-
perms_needed,
652-
protected,
653-
) = super().get_deleted_objects(objs, request)
654-
655-
if request.user and request.user.is_superuser:
656-
perms_needed = set()
657-
658-
deleted_objects = ()
659-
return deleted_objects, model_count, perms_needed, protected
648+
return [], {}, set(), []
660649

661650
def save_related(self, request: HttpRequest, form, formsets, change: bool) -> None:
662651
if formsets:

core/admin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ def delete_queryset(self, request, queryset) -> None:
104104
def delete_model(self, request, obj) -> None:
105105
TaskService().flush_repo(repository_id=obj.repoid)
106106

107+
def get_deleted_objects(self, objs, request):
108+
return [], {}, set(), []
109+
107110

108111
@admin.register(Pull)
109112
class PullsAdmin(AdminMixin, admin.ModelAdmin):

0 commit comments

Comments
 (0)