Skip to content

Commit

Permalink
Merge pull request #460 from skayred/main
Browse files Browse the repository at this point in the history
Optimized source page and dashboard loading
  • Loading branch information
meeb authored Jan 17, 2024
2 parents b11b667 + 3573c11 commit e4e0b48
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tubesync/sync/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def get_context_data(self, *args, **kwargs):
# Disk usage
disk_usage = Media.objects.filter(
downloaded=True, downloaded_filesize__isnull=False
).aggregate(Sum('downloaded_filesize'))
).defer('metadata').aggregate(Sum('downloaded_filesize'))
data['disk_usage_bytes'] = disk_usage['downloaded_filesize__sum']
if not data['disk_usage_bytes']:
data['disk_usage_bytes'] = 0
Expand All @@ -71,11 +71,11 @@ def get_context_data(self, *args, **kwargs):
# Latest downloads
data['latest_downloads'] = Media.objects.filter(
downloaded=True, downloaded_filesize__isnull=False
).order_by('-download_date')[:10]
).defer('metadata').order_by('-download_date')[:10]
# Largest downloads
data['largest_downloads'] = Media.objects.filter(
downloaded=True, downloaded_filesize__isnull=False
).order_by('-downloaded_filesize')[:10]
).defer('metadata').order_by('-downloaded_filesize')[:10]
# UID and GID
data['uid'] = os.getuid()
data['gid'] = os.getgid()
Expand Down Expand Up @@ -404,7 +404,7 @@ def get_context_data(self, *args, **kwargs):
error_message = get_error_message(error)
setattr(error, 'error_message', error_message)
data['errors'].append(error)
data['media'] = Media.objects.filter(source=self.object).order_by('-published')
data['media'] = Media.objects.filter(source=self.object).order_by('-published').defer('metadata')
return data


Expand Down

0 comments on commit e4e0b48

Please sign in to comment.