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

[tor-commits] [metrics-web/master] Clean up main method for importing relay descriptors.



commit ed016c9e3552b72be8f4dc2bb46de259f226d04a
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Wed Mar 21 15:18:23 2012 +0100

    Clean up main method for importing relay descriptors.
---
 src/org/torproject/ernie/cron/Main.java |   34 +++++++++++-------------------
 1 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/src/org/torproject/ernie/cron/Main.java b/src/org/torproject/ernie/cron/Main.java
index 1c8ca48..8022fcc 100644
--- a/src/org/torproject/ernie/cron/Main.java
+++ b/src/org/torproject/ernie/cron/Main.java
@@ -37,28 +37,20 @@ public class Main {
         new BridgeStatsFileHandler(
         config.getRelayDescriptorDatabaseJDBC()) : null;
 
-    // Prepare writing relay descriptors to database
-    RelayDescriptorDatabaseImporter rddi =
-        config.getWriteRelayDescriptorDatabase() ||
-        config.getWriteRelayDescriptorsRawFiles() ?
-        new RelayDescriptorDatabaseImporter(
-        config.getWriteRelayDescriptorDatabase() ?
-        config.getRelayDescriptorDatabaseJDBC() : null,
-        config.getWriteRelayDescriptorsRawFiles() ?
-        config.getRelayDescriptorRawFilesDirectory() : null) : null;
-
     // Import relay descriptors
-    if (rddi != null) {
-      if (config.getImportDirectoryArchives()) {
-        new ArchiveReader(rddi, bsfh,
-            new File(config.getDirectoryArchivesDirectory()),
-            statsDirectory,
-            config.getKeepDirectoryArchiveImportHistory());
-      }
-    }
-
-    // Close database connection (if active)
-    if (rddi != null)   {
+    if (config.getImportDirectoryArchives()) {
+      RelayDescriptorDatabaseImporter rddi =
+          config.getWriteRelayDescriptorDatabase() ||
+          config.getWriteRelayDescriptorsRawFiles() ?
+          new RelayDescriptorDatabaseImporter(
+          config.getWriteRelayDescriptorDatabase() ?
+          config.getRelayDescriptorDatabaseJDBC() : null,
+          config.getWriteRelayDescriptorsRawFiles() ?
+          config.getRelayDescriptorRawFilesDirectory() : null) : null;
+      new ArchiveReader(rddi, bsfh,
+          new File(config.getDirectoryArchivesDirectory()),
+          statsDirectory,
+          config.getKeepDirectoryArchiveImportHistory());
       rddi.closeConnection();
     }
 



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