markusthoemmes commented on a change in pull request #2795: enable concurrent 
activation processing
URL: 
https://github.com/apache/incubator-openwhisk/pull/2795#discussion_r184601872
 
 

 ##########
 File path: 
core/invoker/src/main/scala/whisk/core/containerpool/ContainerPool.scala
 ##########
 @@ -266,11 +273,14 @@ object ContainerPool {
    * since this would be picked up earlier in the scheduler and the container 
reused.
    *
    * @param pool a map of all free containers in the pool
+   * @param checkConcurrent if true only consider containers not processing 
other concurrent activations (otherwise disregard concurrent activation counts)
    * @return a container to be removed iff found
    */
-  protected[containerpool] def remove[A](pool: Map[A, ContainerData]): 
Option[A] = {
+  protected[containerpool] def remove[A](pool: Map[A, ContainerData], 
checkConcurrent: Boolean): Option[A] = {
+    // Try to find a Free container that does NOT have any active activations 
AND is initialized with any OTHER action
     val freeContainers = pool.collect {
-      case (ref, w: WarmedData) => ref -> w
+      case (ref, w: WarmedData) if !checkConcurrent || 
ActivationCounter.getOrElse(ref, 0) == 0 =>
 
 Review comment:
   This becomes
   
   ```scala
   case (ref, w: WarmedData) if w.activationCount == 0 =>
   ```
   
   And you can remove the boolean flag if we can add the counter to 
`WarmedData`.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to