summaryrefslogtreecommitdiffstats
path: root/mirrors
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-10-02 01:08:54 +0200
committerDan McGee <dan@archlinux.org>2010-10-02 01:08:54 +0200
commited49122429276ea1ee9b5b07507e9a3ba3f71cf2 (patch)
tree6da313f8fe4238dc5bd981516bb1de8ad8001a49 /mirrors
parent77f65bdc0c9f5524ca68be511af4280f08fbcc13 (diff)
downloadarchweb-ed49122429276ea1ee9b5b07507e9a3ba3f71cf2.tar.gz
archweb-ed49122429276ea1ee9b5b07507e9a3ba3f71cf2.tar.xz
Fix an off by one error in math for check interval
Because we are averaging the interval and not the value, we need to subtract one from the total we are dividing by. Whoops. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors')
-rw-r--r--mirrors/utils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/mirrors/utils.py b/mirrors/utils.py
index a26b19c..e6d6c1d 100644
--- a/mirrors/utils.py
+++ b/mirrors/utils.py
@@ -40,7 +40,11 @@ def get_mirror_statuses(cutoff=default_cutoff):
check_info = MirrorLog.objects.filter(
check_time__gte=cutoff_time).aggregate(
mn=Min('check_time'), mx=Max('check_time'))
- check_frequency = (check_info['mx'] - check_info['mn']) / num_checks
+ if num_checks > 1:
+ check_frequency = (check_info['mx'] - check_info['mn']) \
+ / (num_checks - 1)
+ else:
+ check_frequency = None;
else:
last_check = None
num_checks = 0