[tor-commits] [metrics-web/master] Avoid division by zero.

karsten at torproject.org karsten at torproject.org
Tue Sep 15 04:27:37 UTC 2015


commit a89aa52052193562d43eaa330027b95fbd7103d7
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Mon Sep 14 08:38:09 2015 +0200

    Avoid division by zero.
    
    This error occurred a few times in late August and early September
    2015, and even though it's unclear how bytes.seconds can ever be 0, it
    seems harmless to remove these rows.
    
    Fixes #17008.
---
 modules/clients/init-userstats.sql |    1 +
 1 file changed, 1 insertion(+)

diff --git a/modules/clients/init-userstats.sql b/modules/clients/init-userstats.sql
index 7c5df3d..00b7938 100644
--- a/modules/clients/init-userstats.sql
+++ b/modules/clients/init-userstats.sql
@@ -491,6 +491,7 @@ BEGIN
       AND bytes.node = responses.node
       WHERE bytes.metric = 'bytes'
       AND responses.metric = 'responses'
+      AND bytes.seconds > 0
       GROUP BY bytes.date, bytes.node
     ) aggregated_bytes_responses
     WHERE aggregated.date = aggregated_bytes_responses.date



More information about the tor-commits mailing list