summaryrefslogtreecommitdiffstats
path: root/mirrors
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-04-08 21:00:56 -0500
committerDan McGee <dan@archlinux.org>2012-04-08 21:00:56 -0500
commit3813ca597b3d76538f4d495e5eaf5b649e77adff (patch)
tree8fb21b1302623e8237e04a6e999f149641b68fa8 /mirrors
parent8d3a1a1c504a70dd23d36c3ed5be0ebcd2f7a86d (diff)
downloadarchweb-3813ca597b3d76538f4d495e5eaf5b649e77adff.tar.gz
archweb-3813ca597b3d76538f4d495e5eaf5b649e77adff.zip
Don't blow up when no mirror status data is available
The check here was wrong before; in the case of no mirror log entries the returned value will not be empty, but will contain two empty values. Check the values instead to see if we have valid data available. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors')
-rw-r--r--mirrors/utils.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/mirrors/utils.py b/mirrors/utils.py
index 619d5f5c..ddecb095 100644
--- a/mirrors/utils.py
+++ b/mirrors/utils.py
@@ -108,7 +108,7 @@ def get_mirror_url_for_download(cutoff=default_cutoff):
status_data = MirrorLog.objects.filter(
check_time__gte=cutoff_time).aggregate(
Max('check_time'), Max('last_sync'))
- if status_data:
+ if status_data['check_time__max'] is not None:
min_check_time = status_data['check_time__max'] - timedelta(minutes=5)
min_sync_time = status_data['last_sync__max'] - timedelta(minutes=30)
best_logs = MirrorLog.objects.filter(is_success=True,