lordcheng10 commented on a change in pull request #13609:
URL: https://github.com/apache/pulsar/pull/13609#discussion_r780592767



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/LinuxBrokerHostUsageImpl.java
##########
@@ -105,9 +105,14 @@ public void calculateBrokerHostUsage() {
         double totalNicUsageRx = getTotalNicUsageRxKb(nics);
         double totalCpuLimit = getTotalCpuLimit();
 
-        SystemResourceUsage usage = new SystemResourceUsage();
         long now = System.currentTimeMillis();
         double elapsedSeconds = (now - lastCollection) / 1000d;
+        if (elapsedSeconds <= 0) {
+            log.warn("elapsedSeconds {} is not expected,skip this round of 
calculateBrokerHostUsage", elapsedSeconds);

Review comment:
       OK

##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/LinuxBrokerHostUsageImpl.java
##########
@@ -105,9 +105,14 @@ public void calculateBrokerHostUsage() {
         double totalNicUsageRx = getTotalNicUsageRxKb(nics);
         double totalCpuLimit = getTotalCpuLimit();
 
-        SystemResourceUsage usage = new SystemResourceUsage();
         long now = System.currentTimeMillis();
         double elapsedSeconds = (now - lastCollection) / 1000d;
+        if (elapsedSeconds <= 0) {
+            log.warn("elapsedSeconds {} is not expected,skip this round of 
calculateBrokerHostUsage", elapsedSeconds);

Review comment:
       Please review again, thank you! Following your suggestion, I made the 
following changes: @Shoothzj
   
   add a space in log content :
   log.warn("elapsedSeconds {} is not expected, skip this round of 
calculateBrokerHostUsage", elapsedSeconds);

##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/LinuxBrokerHostUsageImpl.java
##########
@@ -105,9 +105,14 @@ public void calculateBrokerHostUsage() {
         double totalNicUsageRx = getTotalNicUsageRxKb(nics);
         double totalCpuLimit = getTotalCpuLimit();
 
-        SystemResourceUsage usage = new SystemResourceUsage();
         long now = System.currentTimeMillis();
         double elapsedSeconds = (now - lastCollection) / 1000d;
+        if (elapsedSeconds <= 0) {
+            log.warn("elapsedSeconds {} is not expected,skip this round of 
calculateBrokerHostUsage", elapsedSeconds);

Review comment:
       Following your suggestion, I made the following changes. Please review 
again, thank you!  @Shoothzj 
   1.add a space in log content :
   log.warn("elapsedSeconds {} is not expected, skip this round of 
calculateBrokerHostUsage", elapsedSeconds);




-- 
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]


Reply via email to