summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-07-13 17:46:58 +0200
committerDan McGee <dan@archlinux.org>2013-07-13 17:46:58 +0200
commitb6678513858c5c4ad55082cec137e6870a22f7a4 (patch)
tree733dba91609866d4ca7f0c62589dc4f1198169d2
parentffaa2cfb254a238ba0eb704115b95360305d1ae7 (diff)
downloadarchweb-b6678513858c5c4ad55082cec137e6870a22f7a4.tar.gz
archweb-b6678513858c5c4ad55082cec137e6870a22f7a4.tar.xz
Fix completion percentage calculation in mirror status
We sometimes record a duration even on a failed fetch attempt, such as if we get an HTTP 404. However, we never record a last_sync value on a failed fetch. Use this field instead to sum up the total number of successful checks. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--mirrors/utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/mirrors/utils.py b/mirrors/utils.py
index bba8e36..633731a 100644
--- a/mirrors/utils.py
+++ b/mirrors/utils.py
@@ -35,7 +35,7 @@ def status_data(cutoff_time, mirror_id=None):
sql = """
SELECT l.url_id, u.mirror_id,
COUNT(l.id) AS check_count,
- COUNT(l.duration) AS success_count,
+ COUNT(l.last_sync) AS success_count,
MAX(l.last_sync) AS last_sync,
MAX(l.check_time) AS last_check,
AVG(l.duration) AS duration_avg,
@@ -51,7 +51,7 @@ GROUP BY l.url_id, u.mirror_id
sql = """
SELECT l.url_id, u.mirror_id,
COUNT(l.id) AS check_count,
- COUNT(l.duration) AS success_count,
+ COUNT(l.last_sync) AS success_count,
MAX(l.last_sync) AS last_sync,
MAX(l.check_time) AS last_check,
AVG(l.duration) AS duration_avg,