Skip to content

Commit

Permalink
TorDiscovery: Be less spammy about timed out circuits. A lot always t…
Browse files Browse the repository at this point in the history
…ime out.
  • Loading branch information
mikehearn committed Apr 27, 2014
1 parent d39cc88 commit 6c3b6ce
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,16 @@ public Circuit call() throws Exception {
}));
}

int timeouts = 0;
threadPool.awaitTermination(timeoutValue, timeoutUnit);
for (ListenableFuture<Circuit> future : circuitFutures) {
if (!future.isDone()) {
log.warn("circuit timed out");
timeouts++;
future.cancel(true);
}
}
if (timeouts > 0)
log.warn("{} DNS lookup circuits timed out", timeouts);

try {
List<Circuit> circuits = new ArrayList<Circuit>(Futures.successfulAsList(circuitFutures).get());
Expand Down Expand Up @@ -192,12 +195,15 @@ public Lookup call() throws Exception {
}

threadPool.awaitTermination(timeoutValue, timeoutUnit);
int timeouts = 0;
for (ListenableFuture<Lookup> future : lookupFutures) {
if (!future.isDone()) {
log.warn("circuit timed out");
timeouts++;
future.cancel(true);
}
}
if (timeouts > 0)
log.warn("{} DNS lookup circuits timed out", timeouts);

try {
List<Lookup> lookups = new ArrayList<Lookup>(Futures.successfulAsList(lookupFutures).get());
Expand Down

0 comments on commit 6c3b6ce

Please sign in to comment.