Skip to content

🐛 Fix container deletion stuck on large journal entry count#238

Merged
fanshan merged 3 commits into
mainfrom
fix/container-delete-journal-overflow
May 29, 2026
Merged

🐛 Fix container deletion stuck on large journal entry count#238
fanshan merged 3 commits into
mainfrom
fix/container-delete-journal-overflow

Conversation

@fanshan
Copy link
Copy Markdown
Collaborator

@fanshan fanshan commented May 28, 2026

Override Container.delete() to remove journal entries via _raw_delete before the Django cascade, bypassing per-row post_delete signals (ObjectChange writes) that made deletion O(n) slow for containers with thousands of journal entries.

Override Container.delete() to remove journal entries via _raw_delete
before the Django cascade, bypassing per-row post_delete signals
(ObjectChange writes) that made deletion O(n) slow for containers
with thousands of journal entries.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@fanshan fanshan requested a review from lvenier May 28, 2026 16:19
fanshan and others added 2 commits May 28, 2026 18:21
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…unts

Override _get_dependent_objects to skip JournalEntry from the Django
Collector (avoids fetching all rows) and replace it with a lazy COUNT
proxy that answers len() with a single indexed COUNT(*) query and yields
nothing on iteration. The accordion header shows the correct count while
the page loads instantly regardless of journal entry volume.

Also add select_related("host", "image") on the queryset to avoid N+1
queries when rendering the confirmation page.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@fanshan fanshan merged commit 68286b2 into main May 29, 2026
2 checks passed
@fanshan fanshan deleted the fix/container-delete-journal-overflow branch May 29, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants