[tor-commits] [nyx/master] Truncate average connction counts to ints

atagar at torproject.org atagar at torproject.org
Wed Nov 1 18:36:46 UTC 2017


commit 811129d5f9c7dfccdd22b7f12141c799d9292a02
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Nov 1 11:13:38 2017 -0700

    Truncate average connction counts to ints
    
    Oops, we displayed an unbounded decimal precision for the connection graph's
    average count. Who cares what the sixth decimal point of precision is? :P
    
    It's an average of a big whole number. As such just truncating to ints. Caught
    thanks to Toralf.
---
 nyx/panel/graph.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/nyx/panel/graph.py b/nyx/panel/graph.py
index ff110e6..0d28a35 100644
--- a/nyx/panel/graph.py
+++ b/nyx/panel/graph.py
@@ -389,8 +389,8 @@ class ConnectionStats(GraphCategory):
     self.primary.update(inbound_count)
     self.secondary.update(outbound_count)
 
-    self._primary_header_stats = [str(self.primary.latest_value), ', avg: %s' % self.primary.average()]
-    self._secondary_header_stats = [str(self.secondary.latest_value), ', avg: %s' % self.secondary.average()]
+    self._primary_header_stats = [str(self.primary.latest_value), ', avg: %i' % self.primary.average()]
+    self._secondary_header_stats = [str(self.secondary.latest_value), ', avg: %i' % self.secondary.average()]
 
 
 class ResourceStats(GraphCategory):





More information about the tor-commits mailing list