diff options
author | Dan McGee <dan@archlinux.org> | 2012-11-19 15:10:21 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-11-21 06:25:04 +0100 |
commit | f0f6f7235a62186c1cae9c79036dde5d8821373d (patch) | |
tree | ded90501fde58ae11ca4aaf39656835e8c4e5f7e /mirrors | |
parent | 9db1d4c6a0c60f32628dbd8d217fbd6c3ba99509 (diff) | |
download | archweb-f0f6f7235a62186c1cae9c79036dde5d8821373d.tar.gz archweb-f0f6f7235a62186c1cae9c79036dde5d8821373d.tar.xz |
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>
Diffstat (limited to 'mirrors')
-rw-r--r-- | mirrors/utils.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mirrors/utils.py b/mirrors/utils.py index 07a7138..a62c7f0 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) |