Loading src/main/java/org/torproject/metrics/collector/relaydescs/RelayDescriptorDownloader.java +11 −11 Original line number Diff line number Diff line Loading @@ -347,7 +347,7 @@ public class RelayDescriptorDownloader { "stats/missing-relay-descriptors"); if (this.missingDescriptorsFile.exists()) { try { logger.warn("Reading file {}...", logger.debug("Reading file {}...", this.missingDescriptorsFile.getAbsolutePath()); BufferedReader br = new BufferedReader(new FileReader( this.missingDescriptorsFile)); Loading Loading @@ -395,12 +395,12 @@ public class RelayDescriptorDownloader { } } } else { logger.warn("Invalid line '{}' in {}. Ignoring.", line, logger.debug("Invalid line '{}' in {}. Ignoring.", line, this.missingDescriptorsFile.getAbsolutePath()); } } br.close(); logger.warn("Finished reading file {}.", logger.debug("Finished reading file {}.", this.missingDescriptorsFile.getAbsolutePath()); } catch (IOException e) { logger.warn("Failed to read file {}! This means that we might forget " Loading @@ -416,14 +416,14 @@ public class RelayDescriptorDownloader { "stats/last-downloaded-all-descriptors"); if (this.lastDownloadedAllDescriptorsFile.exists()) { try { logger.warn("Reading file {}...", logger.debug("Reading file {}...", this.lastDownloadedAllDescriptorsFile.getAbsolutePath()); BufferedReader br = new BufferedReader(new FileReader( this.lastDownloadedAllDescriptorsFile)); String line; while ((line = br.readLine()) != null) { if (line.split(",").length != 2) { logger.warn("Invalid line '{}' in {}. Ignoring.", line, logger.debug("Invalid line '{}' in {}. Ignoring.", line, this.lastDownloadedAllDescriptorsFile.getAbsolutePath()); } else { String[] parts = line.split(","); Loading @@ -434,7 +434,7 @@ public class RelayDescriptorDownloader { } } br.close(); logger.warn("Finished reading file {}.", logger.debug("Finished reading file {}.", this.lastDownloadedAllDescriptorsFile.getAbsolutePath()); } catch (IOException e) { logger.warn("Failed to read file {}! This means that we might " Loading @@ -444,7 +444,7 @@ public class RelayDescriptorDownloader { } } /* Make a list of at most four directory authorities that we want to /* Make a list of all directory authorities that we want to * download all server and extra-info descriptors from. */ this.downloadAllDescriptorsFromAuthorities = new HashSet<>(); for (String authority : this.authorities) { Loading Loading @@ -896,7 +896,7 @@ public class RelayDescriptorDownloader { URL url = new URL(fullUrl); allData = Downloader.downloadFromHttpServer(url, isCompressed); int receivedDescriptors = 0; logger.warn("Downloaded {} -> ({} bytes)", fullUrl, logger.debug("Downloaded {} -> ({} bytes)", fullUrl, allData == null ? 0 : allData.length); /* TODO This should be refactored to take into account that the download * is tried a defined number of times. */ Loading @@ -909,7 +909,7 @@ public class RelayDescriptorDownloader { + "will wait 45 SECONDS to avoid DOS protections.", authority); TimeUnit.SECONDS.sleep(45); allData = Downloader.downloadFromHttpServer(url, isCompressed); logger.warn("Downloaded {} -> ({} bytes)", fullUrl, logger.debug("Downloaded {} -> ({} bytes)", fullUrl, allData == null ? 0 : allData.length); if (null != allData) { receivedDescriptors = processDownloadResponse(resource, allData, Loading Loading @@ -1028,7 +1028,7 @@ public class RelayDescriptorDownloader { int missingServerDescriptors = 0; int missingExtraInfoDescriptors = 0; try { logger.warn("Writing file {}...", logger.debug("Writing file {}...", this.missingDescriptorsFile.getAbsolutePath()); this.missingDescriptorsFile.getParentFile().mkdirs(); BufferedWriter bw = new BufferedWriter(new FileWriter( Loading @@ -1055,7 +1055,7 @@ public class RelayDescriptorDownloader { bw.write(key + "," + value + "\n"); } bw.close(); logger.warn("Finished writing file {}.", logger.debug("Finished writing file {}.", this.missingDescriptorsFile.getAbsolutePath()); } catch (IOException e) { logger.warn("Failed writing {}!", Loading Loading
src/main/java/org/torproject/metrics/collector/relaydescs/RelayDescriptorDownloader.java +11 −11 Original line number Diff line number Diff line Loading @@ -347,7 +347,7 @@ public class RelayDescriptorDownloader { "stats/missing-relay-descriptors"); if (this.missingDescriptorsFile.exists()) { try { logger.warn("Reading file {}...", logger.debug("Reading file {}...", this.missingDescriptorsFile.getAbsolutePath()); BufferedReader br = new BufferedReader(new FileReader( this.missingDescriptorsFile)); Loading Loading @@ -395,12 +395,12 @@ public class RelayDescriptorDownloader { } } } else { logger.warn("Invalid line '{}' in {}. Ignoring.", line, logger.debug("Invalid line '{}' in {}. Ignoring.", line, this.missingDescriptorsFile.getAbsolutePath()); } } br.close(); logger.warn("Finished reading file {}.", logger.debug("Finished reading file {}.", this.missingDescriptorsFile.getAbsolutePath()); } catch (IOException e) { logger.warn("Failed to read file {}! This means that we might forget " Loading @@ -416,14 +416,14 @@ public class RelayDescriptorDownloader { "stats/last-downloaded-all-descriptors"); if (this.lastDownloadedAllDescriptorsFile.exists()) { try { logger.warn("Reading file {}...", logger.debug("Reading file {}...", this.lastDownloadedAllDescriptorsFile.getAbsolutePath()); BufferedReader br = new BufferedReader(new FileReader( this.lastDownloadedAllDescriptorsFile)); String line; while ((line = br.readLine()) != null) { if (line.split(",").length != 2) { logger.warn("Invalid line '{}' in {}. Ignoring.", line, logger.debug("Invalid line '{}' in {}. Ignoring.", line, this.lastDownloadedAllDescriptorsFile.getAbsolutePath()); } else { String[] parts = line.split(","); Loading @@ -434,7 +434,7 @@ public class RelayDescriptorDownloader { } } br.close(); logger.warn("Finished reading file {}.", logger.debug("Finished reading file {}.", this.lastDownloadedAllDescriptorsFile.getAbsolutePath()); } catch (IOException e) { logger.warn("Failed to read file {}! This means that we might " Loading @@ -444,7 +444,7 @@ public class RelayDescriptorDownloader { } } /* Make a list of at most four directory authorities that we want to /* Make a list of all directory authorities that we want to * download all server and extra-info descriptors from. */ this.downloadAllDescriptorsFromAuthorities = new HashSet<>(); for (String authority : this.authorities) { Loading Loading @@ -896,7 +896,7 @@ public class RelayDescriptorDownloader { URL url = new URL(fullUrl); allData = Downloader.downloadFromHttpServer(url, isCompressed); int receivedDescriptors = 0; logger.warn("Downloaded {} -> ({} bytes)", fullUrl, logger.debug("Downloaded {} -> ({} bytes)", fullUrl, allData == null ? 0 : allData.length); /* TODO This should be refactored to take into account that the download * is tried a defined number of times. */ Loading @@ -909,7 +909,7 @@ public class RelayDescriptorDownloader { + "will wait 45 SECONDS to avoid DOS protections.", authority); TimeUnit.SECONDS.sleep(45); allData = Downloader.downloadFromHttpServer(url, isCompressed); logger.warn("Downloaded {} -> ({} bytes)", fullUrl, logger.debug("Downloaded {} -> ({} bytes)", fullUrl, allData == null ? 0 : allData.length); if (null != allData) { receivedDescriptors = processDownloadResponse(resource, allData, Loading Loading @@ -1028,7 +1028,7 @@ public class RelayDescriptorDownloader { int missingServerDescriptors = 0; int missingExtraInfoDescriptors = 0; try { logger.warn("Writing file {}...", logger.debug("Writing file {}...", this.missingDescriptorsFile.getAbsolutePath()); this.missingDescriptorsFile.getParentFile().mkdirs(); BufferedWriter bw = new BufferedWriter(new FileWriter( Loading @@ -1055,7 +1055,7 @@ public class RelayDescriptorDownloader { bw.write(key + "," + value + "\n"); } bw.close(); logger.warn("Finished writing file {}.", logger.debug("Finished writing file {}.", this.missingDescriptorsFile.getAbsolutePath()); } catch (IOException e) { logger.warn("Failed writing {}!", Loading