rabbah commented on a change in pull request #4593: Change ContainerPool buffer processing URL: https://github.com/apache/openwhisk/pull/4593#discussion_r348710375
########## File path: core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala ########## @@ -479,22 +497,37 @@ class ContainerProxy(factory: (TransactionId, /** Either process runbuffer or signal parent to send work; return true if runbuffer is being processed */ def requestWork(newData: WarmedData): Boolean = { - //if there is concurrency capacity, process runbuffer, or signal NeedWork + //if there is concurrency capacity, process runbuffer, signal NeedWork, or both if (activeCount < newData.action.limits.concurrency.maxConcurrent) { - runBuffer.dequeueOption match { - case Some((run, q)) => - runBuffer = q - self ! run - true - case _ => - context.parent ! NeedWork(newData) - false + if (runBuffer.length > 0) { + processBuffer(newData.action, newData) + true + } else { + context.parent ! NeedWork(newData) + bufferProcessing //true in case buffer is still in process } } else { false } } + /** Process buffered items up to the capacity of action concurrency config */ + def processBuffer(action: ExecutableWhiskAction, newData: ContainerData) = { + //send as many buffered as possible + var available = action.limits.concurrency.maxConcurrent - activeCount + logging.info(this, s"resending up to ${available} from ${runBuffer.length} buffered jobs") + while (available > 0 && runBuffer.length > 0) { Review comment: nice @style95 👏 ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services