ningyougang commented on a change in pull request #3272: improve loadbalancer's 
schedule algorithm
URL: 
https://github.com/apache/incubator-openwhisk/pull/3272#discussion_r167460091
 
 

 ##########
 File path: 
core/controller/src/main/scala/whisk/core/loadBalancer/ContainerPoolBalancer.scala
 ##########
 @@ -345,7 +345,8 @@ object ContainerPoolBalancer extends LoadBalancerProvider {
         .find(_._3 < invokerBusyThreshold)
         .orElse(invokerProgression.find(_._3 < invokerBusyThreshold * 2))
         .orElse(invokerProgression.find(_._3 < invokerBusyThreshold * 3))
-        .orElse(invokerProgression.headOption)
+        .orElse(
+          if (invokerProgression.size == 0) None else 
invokerProgression.lift(Random.nextInt(invokerProgression.size)))
 
 Review comment:
   @markusthoemmes , can you look at this again? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to