Skip to content

Commit 0c91e52

Browse files
committed
Fix review points
1 parent 743070e commit 0c91e52

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerPool.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,17 @@ class ContainerPool(childFactory: ActorRefFactory => ActorRef,
135135
.map(container => (container, container._2.initingState)) //warmed, warming, and warmingCold always know their state
136136
.orElse(
137137
// There was no warm/warming/warmingCold container. Try to take a prewarm container or a cold container.
138-
139-
// Is there enough space to create a new container or do other containers have to be removed?
140-
if (hasPoolSpaceFor(busyPool ++ freePool ++ prewarmedPool, prewarmStartingPool, memory)) {
141-
takePrewarmContainer(r.action)
142-
.map(container => (container, "prewarmed"))
143-
.orElse {
138+
// When take prewarm container, has no need to judge whether user memory is enough
139+
takePrewarmContainer(r.action)
140+
.map(container => (container, "prewarmed"))
141+
.orElse {
142+
// Is there enough space to create a new container or do other containers have to be removed?
143+
if (hasPoolSpaceFor(busyPool ++ freePool ++ prewarmedPool, prewarmStartingPool, memory)) {
144144
val container = Some(createContainer(memory), "cold")
145145
incrementColdStartCount(kind, memory)
146146
container
147-
}
148-
} else None)
147+
} else None
148+
})
149149
.orElse(
150150
// Remove a container and create a new one for the given job
151151
ContainerPool
@@ -444,7 +444,7 @@ class ContainerPool(childFactory: ActorRefFactory => ActorRef,
444444
def hasPoolSpaceFor[A](pool: Map[A, ContainerData],
445445
prewarmStartingPool: Map[A, (String, ByteSize)],
446446
memory: ByteSize): Boolean = {
447-
memoryConsumptionOf(pool) + +prewarmStartingPool.map(_._2._2.toMB).sum + memory.toMB <= poolConfig.userMemory.toMB
447+
memoryConsumptionOf(pool) + prewarmStartingPool.map(_._2._2.toMB).sum + memory.toMB <= poolConfig.userMemory.toMB
448448
}
449449

450450
/**

0 commit comments

Comments
 (0)