You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/01/05 02:17:42 UTC

[GitHub] [pulsar] Jason918 commented on a change in pull request #13609: Fix bug :Infinity value for CPU or Bandwidth usage

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



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/LinuxBrokerHostUsageImpl.java
##########
@@ -84,11 +87,12 @@ public LinuxBrokerHostUsageImpl(int hostUsageCheckIntervalMin,
             log.warn("Failed to check cgroup CPU usage file: {}", e.getMessage());
         }
         this.isCGroupsEnabled = isCGroupsEnabled;
+        this.executorService = executorService;
+        this.hostUsageCheckIntervalMin = hostUsageCheckIntervalMin;
 
         // Call now to initialize values before the constructor returns
         calculateBrokerHostUsage();
-        executorService.scheduleAtFixedRate(catchingAndLoggingThrowables(this::calculateBrokerHostUsage),
-                hostUsageCheckIntervalMin,
+        this.executorService.schedule(catchingAndLoggingThrowables(this::calculateBrokerHostUsage),

Review comment:
       IMHO, `scheduleAtFixedDelay` is better.




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org