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

[tor-commits] [collector/master] Avoid DescriptorReader's setExcludeFiles().



commit 24a849780652cbf564651c4df2b811167e8f98fa
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Sat May 13 20:31:36 2017 +0200

    Avoid DescriptorReader's setExcludeFiles().
---
 .../java/org/torproject/collector/relaydescs/ReferenceChecker.java  | 3 ++-
 src/main/java/org/torproject/collector/sync/SyncManager.java        | 6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/torproject/collector/relaydescs/ReferenceChecker.java b/src/main/java/org/torproject/collector/relaydescs/ReferenceChecker.java
index 7c10379..1b0025b 100644
--- a/src/main/java/org/torproject/collector/relaydescs/ReferenceChecker.java
+++ b/src/main/java/org/torproject/collector/relaydescs/ReferenceChecker.java
@@ -168,7 +168,7 @@ public class ReferenceChecker {
     DescriptorReader descriptorReader =
         DescriptorSourceFactory.createDescriptorReader();
     descriptorReader.addDirectory(this.descriptorsDir);
-    descriptorReader.setExcludeFiles(this.historyFile);
+    descriptorReader.setHistoryFile(this.historyFile);
     Iterator<DescriptorFile> descriptorFiles =
         descriptorReader.readDescriptors();
     while (descriptorFiles.hasNext()) {
@@ -199,6 +199,7 @@ public class ReferenceChecker {
         }
       }
     }
+    descriptorReader.saveHistoryFile(this.historyFile);
   }
 
   private void readRelayNetworkStatusConsensusUnflavored(
diff --git a/src/main/java/org/torproject/collector/sync/SyncManager.java b/src/main/java/org/torproject/collector/sync/SyncManager.java
index b9df0bd..d8d2708 100644
--- a/src/main/java/org/torproject/collector/sync/SyncManager.java
+++ b/src/main/java/org/torproject/collector/sync/SyncManager.java
@@ -82,9 +82,10 @@ public class SyncManager {
         String histFileEnding = entry.getValue().getSimpleName()
             + (entry.getKey().contains("consensus-microdesc")
                ? "-micro" : "");
-        descriptorReader.setExcludeFiles(new File(basePath.toFile(),
+        File historyFile = new File(basePath.toFile(),
             "sync-history-" + source.getHost() + "-" + marker + "-"
-            + histFileEnding));
+            + histFileEnding);
+        descriptorReader.setHistoryFile(historyFile);
         log.info("Reading {} of type {} ... ", marker, histFileEnding);
         Iterator<DescriptorFile> descriptorFiles
             = descriptorReader.readDescriptors();
@@ -108,6 +109,7 @@ public class SyncManager {
           persist.storeDescs(descFile.getDescriptors(),
               descFile.getFile().getName(), collectionDate.getTime());
         }
+        descriptorReader.saveHistoryFile(historyFile);
       }
       log.info("Done merging {} from {}.", marker, source.getHost());
     }



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