summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-11-19 08:10:21 -0600
committerDan McGee <dan@archlinux.org>2012-11-21 00:25:04 -0500
commitf0f6f7235a62186c1cae9c79036dde5d8821373d (patch)
treeded90501fde58ae11ca4aaf39656835e8c4e5f7e
parent9db1d4c6a0c60f32628dbd8d217fbd6c3ba99509 (diff)
Fix mirror URL duplication in status view
We need to ensure we don't duplicate URLs in the status view, so add a distinct() call back in to the queryset when it was inadvertently dropped in commit a2cfa7edbb. This negates a lot of the performance gains we had, unfortunately, so it looks like a nested subquery might be more efficient. Disappointing the planner can't do this for us. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--mirrors/utils.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/mirrors/utils.py b/mirrors/utils.py
index 07a7138f..a62c7f05 100644
--- a/mirrors/utils.py
+++ b/mirrors/utils.py
@@ -48,7 +48,8 @@ def get_mirror_statuses(cutoff=DEFAULT_CUTOFF, mirror_ids=None):
urls = MirrorUrl.objects.select_related('mirror', 'protocol').filter(
mirror__active=True, mirror__public=True,
- logs__check_time__gte=cutoff_time).order_by('mirror__id', 'url')
+ logs__check_time__gte=cutoff_time).distinct().order_by(
+ 'mirror__id', 'url')
if mirror_ids:
url_data = url_data.filter(mirror_id__in=mirror_ids)