[tor-commits] [metrics-web/master] Skip bridge network statuses with zero running bridges.
karsten at torproject.org
karsten at torproject.org
Sun Apr 23 15:52:30 UTC 2017
commit c257f671bd64bacbe15d057be1b83878ad7bf0ce
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date: Wed Mar 1 16:22:27 2017 +0100
Skip bridge network statuses with zero running bridges.
Fixes #21587.
---
.../ernie/cron/network/ConsensusStatsFileHandler.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/modules/legacy/src/main/java/org/torproject/ernie/cron/network/ConsensusStatsFileHandler.java b/modules/legacy/src/main/java/org/torproject/ernie/cron/network/ConsensusStatsFileHandler.java
index 9aef3e4..801794f 100644
--- a/modules/legacy/src/main/java/org/torproject/ernie/cron/network/ConsensusStatsFileHandler.java
+++ b/modules/legacy/src/main/java/org/torproject/ernie/cron/network/ConsensusStatsFileHandler.java
@@ -257,17 +257,23 @@ public class ConsensusStatsFileHandler {
* and bridge authority. */
Map<String, Map<String, int[]>> bridgesPerDayAndAuthority = new HashMap<>();
for (String bridgesRawLine : this.bridgesRaw.values()) {
+ String[] parts = bridgesRawLine.split(",");
+ int brunning = Integer.parseInt(parts[2]);
+ if (brunning <= 0) {
+ /* Skip this status which contains zero bridges with the Running
+ * flag. */
+ continue;
+ }
String date = bridgesRawLine.substring(0, 10);
if (!bridgesPerDayAndAuthority.containsKey(date)) {
bridgesPerDayAndAuthority.put(date, new TreeMap<String, int[]>());
}
- String[] parts = bridgesRawLine.split(",");
String authority = parts[1];
if (!bridgesPerDayAndAuthority.get(date).containsKey(authority)) {
bridgesPerDayAndAuthority.get(date).put(authority, new int[3]);
}
int[] bridges = bridgesPerDayAndAuthority.get(date).get(authority);
- bridges[0] += Integer.parseInt(parts[2]);
+ bridges[0] += brunning;
bridges[1] += Integer.parseInt(parts[3]);
bridges[2]++;
}
More information about the tor-commits
mailing list