eolivelli commented on a change in pull request #14537:
URL: https://github.com/apache/pulsar/pull/14537#discussion_r817617997
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/LinuxBrokerHostUsageImpl.java
##########
@@ -252,10 +252,18 @@ private double getTotalNicLimitKbps(List<String> nics) {
.orElseGet(() -> nics.stream().mapToDouble(nicPath -> {
// Nic speed is in Mbits/s, return kbits/s
try {
- return Double.parseDouble(new
String(Files.readAllBytes(getNicSpeedPath(nicPath))));
+ final Path nicSpeedPath = getNicSpeedPath(nicPath);
+ return readDoubleFromPath(nicSpeedPath);
} catch (IOException e) {
- log.error(String.format("Failed to read speed for nic
%s, maybe you can set broker"
- + " config
[loadBalancerOverrideBrokerNicSpeedGbps] to override it.", nicPath), e);
+ if ("Invalid argument".equals(e.getMessage())) {
Review comment:
we should add some comments here and add references to when/why/where
this could happen
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]