summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mirrors/utils.py14
-rw-r--r--mirrors/views.py5
2 files changed, 9 insertions, 10 deletions
diff --git a/mirrors/utils.py b/mirrors/utils.py
index 4484fa24..8edceb9b 100644
--- a/mirrors/utils.py
+++ b/mirrors/utils.py
@@ -118,20 +118,16 @@ def annotate_url(url, url_data):
def get_mirror_statuses(cutoff=DEFAULT_CUTOFF, mirror_id=None, show_all=False):
cutoff_time = now() - cutoff
- valid_urls = MirrorUrl.objects.filter(
- logs__check_time__gte=cutoff_time).distinct()
-
+ urls = MirrorUrl.objects.select_related(
+ 'mirror', 'protocol').order_by('mirror__id', 'url')
if mirror_id:
- valid_urls = valid_urls.filter(mirror_id=mirror_id)
+ urls = urls.filter(mirror_id=mirror_id)
if not show_all:
- valid_urls = valid_urls.filter(active=True, mirror__active=True,
+ urls = urls.filter(active=True, mirror__active=True,
mirror__public=True)
- url_data = status_data(cutoff, mirror_id)
- urls = MirrorUrl.objects.select_related('mirror', 'protocol').filter(
- id__in=valid_urls).order_by('mirror__id', 'url')
-
if urls:
+ url_data = status_data(cutoff, mirror_id)
urls = [annotate_url(url, url_data.get(url.id, {})) for url in urls]
last_check = max([u.last_check for u in urls if u.last_check])
num_checks = max([u.check_count for u in urls])
diff --git a/mirrors/views.py b/mirrors/views.py
index 1a9741ed..90787763 100644
--- a/mirrors/views.py
+++ b/mirrors/views.py
@@ -245,7 +245,10 @@ def status(request, tier=None):
if tier is not None and url.mirror.tier != tier:
continue
# split them into good and bad lists based on delay
- if not url.delay or url.delay > bad_timedelta:
+ if url.completion_pct is None:
+ # skip URLs that have never been checked
+ continue
+ elif not url.delay or url.delay > bad_timedelta:
bad_urls.append(url)
else:
good_urls.append(url)