Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Network Health
Metrics
Collector
Commits
b61a2060
Commit
b61a2060
authored
Jan 11, 2022
by
Hiro
🏄
Browse files
Remove unused logger warnings
parent
38079c96
Pipeline
#23395
failed with stage
in 2 minutes and 23 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/torproject/metrics/collector/relaydescs/RelayDescriptorDownloader.java
View file @
b61a2060
...
...
@@ -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
));
...
...
@@ -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 "
...
...
@@ -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
(
","
);
...
...
@@ -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 "
...
...
@@ -444,7 +444,7 @@ public class RelayDescriptorDownloader {
}
}
/* Make a list of a
t most four
directory authorities that we want to
/* Make a list of a
ll
directory authorities that we want to
* download all server and extra-info descriptors from. */
this
.
downloadAllDescriptorsFromAuthorities
=
new
HashSet
<>();
for
(
String
authority
:
this
.
authorities
)
{
...
...
@@ -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. */
...
...
@@ -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
,
...
...
@@ -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
(
...
...
@@ -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 {}!"
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment