You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by "bdoyle0182 (via GitHub)" <gi...@apache.org> on 2023/04/18 02:27:33 UTC

[GitHub] [openwhisk] bdoyle0182 commented on a diff in pull request #5396: fix bug in average ring buffer and add negative duration protection to scheduler decision maker

bdoyle0182 commented on code in PR #5396:
URL: https://github.com/apache/openwhisk/pull/5396#discussion_r1169424562


##########
common/scala/src/main/scala/org/apache/openwhisk/common/AverageRingBuffer.scala:
##########
@@ -32,18 +32,12 @@ object AverageRingBuffer {
 class AverageRingBuffer(private val maxSize: Int) {
   private var elements = Vector.empty[Double]
   private var sum = 0.0
-  private var max = 0.0
-  private var min = 0.0
 
   def nonEmpty: Boolean = elements.nonEmpty
 
   def average: Double = {
     val size = elements.size

Review Comment:
   the only place this function is called, it does a `nonEmpty` check first or skips over it. Now debatably that check should also be happening inside this function for sure to prevent the divide by zero; but since it's not an existing issue for the moment I'm going to merge this in to get this fixed.



-- 
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: issues-unsubscribe@openwhisk.apache.org

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