summaryrefslogtreecommitdiff
path: root/mirrors/utils.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-10-07 08:09:07 -0500
committerDan McGee <dan@archlinux.org>2010-10-07 08:09:07 -0500
commit82f3b02f602b8244047ab12f38dadc42f416bd2d (patch)
tree4ed2ffe599ee459313da2e71b2347cdaebf78a40 /mirrors/utils.py
parent2e299273e2462775cf3ecd4f93715678575319fd (diff)
Factor check completion pct into mirror scorerelease_2010-10-07
Use it as the divisor in our slightly longer equation. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'mirrors/utils.py')
-rw-r--r--mirrors/utils.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/mirrors/utils.py b/mirrors/utils.py
index e6d6c1dd..c64d53c5 100644
--- a/mirrors/utils.py
+++ b/mirrors/utils.py
@@ -57,11 +57,16 @@ def get_mirror_statuses(cutoff=default_cutoff):
d = sum(url_delays, datetime.timedelta()) / len(url_delays)
url.delay = d
hours = d.days * 24.0 + d.seconds / 3600.0
- url.score = hours + url.duration_avg + url.duration_stddev
+
+ if url.completion_pct > 0:
+ divisor = url.completion_pct
+ else:
+ # arbitrary small value
+ divisor = 0.005
+ url.score = (hours + url.duration_avg + url.duration_stddev) / divisor
else:
url.delay = None
url.score = None
- url.completion = 0.0
return {
'cutoff': cutoff,