mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-31 23:08:25 -04:00
massively improve Snapshot admin list view query performance
This commit is contained in:
parent
6c4f3fc83a
commit
24fe958ff3
5 changed files with 194 additions and 39 deletions
archivebox/index
|
@ -124,7 +124,15 @@ def snapshot_icons(snapshot) -> str:
|
|||
from core.models import ArchiveResult
|
||||
# start = datetime.now(timezone.utc)
|
||||
|
||||
archive_results = snapshot.archiveresult_set.filter(status="succeeded", output__isnull=False)
|
||||
if hasattr(snapshot, '_prefetched_objects_cache') and 'archiveresult_set' in snapshot._prefetched_objects_cache:
|
||||
archive_results = [
|
||||
result
|
||||
for result in snapshot.archiveresult_set.all()
|
||||
if result.status == "succeeded" and result.output
|
||||
]
|
||||
else:
|
||||
archive_results = snapshot.archiveresult_set.filter(status="succeeded", output__isnull=False)
|
||||
|
||||
link = snapshot.as_link()
|
||||
path = link.archive_path
|
||||
canon = link.canonical_outputs()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue