@@ -269,17 +269,16 @@ func dismissContainer(requiredMemoryMB int64) (bool, error) {
269269 // every container into the funPool has the same memory (same function)
270270 //so it is not important which one you destroy
271271 elem := funPool .idle .Front ()
272- contID := elem .Value .(* container.Container ).ID
273272 // container in the same pool need same memory
274- memory , _ := container .GetMemoryMB (contID )
275- for ok := true ; ok ; ok = elem != nil {
276- containerToDismiss = append (containerToDismiss ,
277- itemToDismiss {contID : contID , pool : funPool , elem : elem , memory : memory })
273+ memory , _ := container .GetMemoryMB (elem .Value .(* container.Container ).ID )
274+
275+ for elem != nil {
276+ contID := elem .Value .(* container.Container ).ID
277+ containerToDismiss = append (containerToDismiss , itemToDismiss {contID : contID , pool : funPool , elem : elem , memory : memory })
278278 cleanedMB += memory
279279 if cleanedMB >= requiredMemoryMB {
280280 goto cleanup
281281 }
282- //go on to the next one
283282 elem = elem .Next ()
284283 }
285284 }
@@ -317,7 +316,6 @@ func DeleteExpiredContainer() {
317316 if now > warm .ExpirationTime {
318317 temp := elem
319318 elem = elem .Next ()
320- //log.Printf("cleaner: Removing container %s\n", warm.contID)
321319 pool .idle .Remove (temp ) // remove the expired element
322320
323321 memory , _ := container .GetMemoryMB (warm .ID )
@@ -326,13 +324,11 @@ func DeleteExpiredContainer() {
326324 if err != nil {
327325 log .Printf ("Error while destroying container %s: %s\n " , warm .ID , err )
328326 }
329- // log.Printf("Released resources. Now: %v\n", &LocalResources)
330327 } else {
331328 elem = elem .Next ()
332329 }
333330 }
334331 }
335-
336332}
337333
338334// ShutdownWarmContainersFor destroys warm containers of a given function
0 commit comments