@@ -125,9 +125,12 @@ class ContainerPool(childFactory: ActorRefFactory => ActorRef,
125125 // remove from resent tracking - it may get resent again, or get processed
126126 resent = None
127127 }
128+ val kind = r.action.exec.kind
129+ val memory = r.action.limits.memory.megabytes.MB
130+
128131 val createdContainer =
129132 // Is there enough space on the invoker for this action to be executed.
130- if (hasPoolSpaceFor(busyPool, r.action.limits. memory.megabytes. MB )) {
133+ if (hasPoolSpaceFor(busyPool ++ prewarmedPool, memory)) {
131134 // Schedule a job to a warm container
132135 ContainerPool
133136 .schedule(r.action, r.msg.user.namespace.name, freePool)
@@ -136,12 +139,12 @@ class ContainerPool(childFactory: ActorRefFactory => ActorRef,
136139 // There was no warm/warming/warmingCold container. Try to take a prewarm container or a cold container.
137140
138141 // Is there enough space to create a new container or do other containers have to be removed?
139- if (hasPoolSpaceFor(busyPool ++ freePool, r.action.limits. memory.megabytes. MB )) {
142+ if (hasPoolSpaceFor(busyPool ++ freePool ++ prewarmedPool, memory)) {
140143 takePrewarmContainer(r.action)
141144 .map(container => (container, " prewarmed" ))
142145 .orElse {
143- val container = Some (createContainer(r.action.limits. memory.megabytes. MB ), " cold" )
144- incrementColdStartCount(r.action.exec. kind, r.action.limits. memory.megabytes. MB )
146+ val container = Some (createContainer(memory), " cold" )
147+ incrementColdStartCount(kind, memory)
145148 container
146149 }
147150 } else None )
@@ -158,8 +161,8 @@ class ContainerPool(childFactory: ActorRefFactory => ActorRef,
158161 takePrewarmContainer(r.action)
159162 .map(container => (container, " recreatedPrewarm" ))
160163 .getOrElse {
161- val container = (createContainer(r.action.limits. memory.megabytes. MB ), " recreated" )
162- incrementColdStartCount(r.action.exec. kind, r.action.limits. memory.megabytes. MB )
164+ val container = (createContainer(memory), " recreated" )
165+ incrementColdStartCount(kind, memory)
163166 container
164167 }))
165168
0 commit comments