[tor-commits] [onionoo/master] Keep at most one parsed descriptor in the queue.

karsten at torproject.org karsten at torproject.org
Wed Jun 18 15:09:14 UTC 2014


commit 6ba913c513eb771e9ba446dcc978df9ce36b82ac
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Wed Jun 18 10:06:46 2014 +0200

    Keep at most one parsed descriptor in the queue.
    
    When we switched to parsing concatenated server and extra-info descriptors
    we limited the descriptor queue to at most one parsed descriptor file.
    Actually, this also makes sense for large descriptors like consensuses.
    There's no need to keep up to 100 of them in the queue, because it takes
    much longer to process them than to parse them.
    
    A quick look at the logs confirms that, with setting the max queue length
    to 1, we almost never have to wait for a descriptor provided by
    metrics-lib.
---
 src/org/torproject/onionoo/DescriptorSource.java |   10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/src/org/torproject/onionoo/DescriptorSource.java b/src/org/torproject/onionoo/DescriptorSource.java
index a9b6175..8246bba 100644
--- a/src/org/torproject/onionoo/DescriptorSource.java
+++ b/src/org/torproject/onionoo/DescriptorSource.java
@@ -277,29 +277,24 @@ class DescriptorQueue {
 
   public void addDirectory(DescriptorType descriptorType) {
     String directoryName = null;
-    int maxDescriptorFilesInQueue = -1;
     switch (descriptorType) {
     case RELAY_CONSENSUSES:
       directoryName = "relay-descriptors/consensuses";
       break;
     case RELAY_SERVER_DESCRIPTORS:
       directoryName = "relay-descriptors/server-descriptors";
-      maxDescriptorFilesInQueue = 1;
       break;
     case RELAY_EXTRA_INFOS:
       directoryName = "relay-descriptors/extra-infos";
-      maxDescriptorFilesInQueue = 1;
       break;
     case BRIDGE_STATUSES:
       directoryName = "bridge-descriptors/statuses";
       break;
     case BRIDGE_SERVER_DESCRIPTORS:
       directoryName = "bridge-descriptors/server-descriptors";
-      maxDescriptorFilesInQueue = 1;
       break;
     case BRIDGE_EXTRA_INFOS:
       directoryName = "bridge-descriptors/extra-infos";
-      maxDescriptorFilesInQueue = 1;
       break;
     case BRIDGE_POOL_ASSIGNMENTS:
       directoryName = "bridge-pool-assignments";
@@ -315,10 +310,7 @@ class DescriptorQueue {
     File directory = new File(this.inDir, directoryName);
     if (directory.exists() && directory.isDirectory()) {
       this.descriptorReader.addDirectory(directory);
-      if (maxDescriptorFilesInQueue >= 1) {
-        this.descriptorReader.setMaxDescriptorFilesInQueue(
-            maxDescriptorFilesInQueue);
-      }
+      this.descriptorReader.setMaxDescriptorFilesInQueue(1);
     } else {
       System.err.println("Directory " + directory.getAbsolutePath()
           + " either does not exist or is not a directory.  Not adding "





More information about the tor-commits mailing list