summaryrefslogtreecommitdiff
path: root/mirrors/views.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-09-23 10:33:32 -0500
committerDan McGee <dan@archlinux.org>2010-09-24 19:39:36 -0500
commit10fca8281663d45c08367f9d5e351c66b670d773 (patch)
tree37c55a3c550f7397073c228380f6f8f17ad123be /mirrors/views.py
parente82e953aa297f1e54d0aff9b2097aaab6d58d0ba (diff)
Give more information about mirror check runs and frequency
Show how many times the check has ran in the last 24 hours, as well as the average interval between checks. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors/views.py')
-rw-r--r--mirrors/views.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/mirrors/views.py b/mirrors/views.py
index 71c896df..5c157894 100644
--- a/mirrors/views.py
+++ b/mirrors/views.py
@@ -55,7 +55,8 @@ def find_mirrors(request, countries=None, protocols=None, use_status=False):
urls = qset.order_by('mirror__country', 'mirror__name', 'url')
template = 'mirrors/mirrorlist.txt'
else:
- scores = dict([(u.id, u.score) for u in get_mirror_statuses()])
+ status_info = get_mirror_statuses()
+ scores = dict([(u.id, u.score) for u in status_info['urls']])
urls = []
for u in qset:
u.score = scores[u.id]
@@ -72,13 +73,9 @@ def find_mirrors(request, countries=None, protocols=None, use_status=False):
def status(request):
bad_timedelta = datetime.timedelta(days=3)
- urls = get_mirror_statuses()
-
- if urls:
- last_check = max([u.last_check for u in urls])
- else:
- last_check = None
+ status_info = get_mirror_statuses()
+ urls = status_info['urls']
good_urls = []
bad_urls = []
for url in urls:
@@ -88,12 +85,12 @@ def status(request):
else:
good_urls.append(url)
- context = {
- 'last_check': last_check,
+ context = status_info.copy()
+ context.update({
'good_urls': good_urls,
'bad_urls': bad_urls,
'error_logs': get_mirror_errors(),
- }
+ })
return direct_to_template(request, 'mirrors/status.html', context)
# vim: set ts=4 sw=4 et: