[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [collector/release] Tone down a warning about outdated assignments.



commit 54ac654d40544bab48cec58ba64546ef6ffe0bfe
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Thu Sep 19 11:08:41 2019 +0200

    Tone down a warning about outdated assignments.
---
 .../BridgePoolAssignmentsProcessor.java            | 23 ++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/torproject/metrics/collector/bridgepools/BridgePoolAssignmentsProcessor.java b/src/main/java/org/torproject/metrics/collector/bridgepools/BridgePoolAssignmentsProcessor.java
index cad91ef..a386fb6 100644
--- a/src/main/java/org/torproject/metrics/collector/bridgepools/BridgePoolAssignmentsProcessor.java
+++ b/src/main/java/org/torproject/metrics/collector/bridgepools/BridgePoolAssignmentsProcessor.java
@@ -115,11 +115,19 @@ public class BridgePoolAssignmentsProcessor extends CollecTorMain {
     logger.info("Starting bridge-pool-assignments module of CollecTor.");
     this.initializeConfiguration();
     List<File> assignmentFiles = this.listAssignmentFiles();
+    LocalDateTime latestPublished = null;
     for (File assignmentFile : assignmentFiles) {
       logger.info("Processing bridge pool assignment file '{}'...",
           assignmentFile.getAbsolutePath());
+      SortedMap<LocalDateTime, SortedMap<String, String>>
+          readBridgePoolAssignments
+          = this.readBridgePoolAssignments(assignmentFile);
+      if (null == latestPublished
+          || readBridgePoolAssignments.lastKey().isAfter(latestPublished)) {
+        latestPublished = readBridgePoolAssignments.lastKey();
+      }
       for (Map.Entry<LocalDateTime, SortedMap<String, String>> e
-           : this.readBridgePoolAssignments(assignmentFile).entrySet()) {
+           : readBridgePoolAssignments.entrySet()) {
         LocalDateTime published = e.getKey();
         SortedMap<String, String> originalAssignments = e.getValue();
         SortedMap<String, String> sanitizedAssignments
@@ -144,6 +152,12 @@ public class BridgePoolAssignmentsProcessor extends CollecTorMain {
         }
       }
     }
+    if (null != latestPublished
+        && latestPublished.minusMinutes(330L).isBefore(LocalDateTime.now())) {
+      logger.warn("The last known bridge pool assignment list was "
+          + "published at {}, which is more than 5:30 hours in the past.",
+          latestPublished);
+    }
     this.cleanUpRsyncDirectory();
     logger.info("Finished processing bridge pool assignment file(s).");
   }
@@ -251,13 +265,6 @@ public class BridgePoolAssignmentsProcessor extends CollecTorMain {
       logger.warn("Could not read bridge pool assignment file '{}'. "
           + "Skipping.", assignmentFile.getAbsolutePath(), e);
     }
-    if (!readBridgePoolAssignments.isEmpty()
-        && readBridgePoolAssignments.lastKey().minusMinutes(330L)
-        .isBefore(LocalDateTime.now())) {
-      logger.warn("The last known bridge pool assignment list was "
-          + "published at {}, which is more than 5:30 hours in the past.",
-          readBridgePoolAssignments.lastKey());
-    }
     return readBridgePoolAssignments;
   }
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits