ijuma commented on code in PR #13056:
URL: https://github.com/apache/kafka/pull/13056#discussion_r1059261768


##########
core/src/main/scala/kafka/utils/Throttler.scala:
##########
@@ -83,6 +86,17 @@ class Throttler(@volatile var desiredRatePerSec: Double,
   def updateDesiredRatePerSec(updatedDesiredRatePerSec: Double): Unit = {
     desiredRatePerSec = updatedDesiredRatePerSec;
   }
+
+  // initial start time if it haven't been set. This method should be called 
when starting do disk IO works.
+  def initStartTimeNs(): Unit = {
+    if (periodStartNs == 0) {
+      lock synchronized {
+        if (periodStartNs == 0) {
+          periodStartNs = time.nanoseconds()
+        }
+      }
+    }
+  }
 }
 
 object Throttler {

Review Comment:
   Or are you saying that there's no benefit in there being a `main` for this? 
If so, then we could indeed remove it. We must make sure there is no script 
relying on it though.



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to