Pushing for blogpost 4 update

This commit is contained in:
frikky
2020-06-28 19:42:08 +02:00
parent dfc639c92b
commit eed0d96ed0
6 changed files with 36 additions and 23 deletions
+4 -1
View File
@@ -432,7 +432,6 @@ func zombiecheck() error {
stopContainers := []string{}
removeContainers := []string{}
for _, container := range containers {
// Skip random containers. Only handle things related to Shuffle.
if !strings.Contains(container.Image, baseimagename) {
shuffleFound := false
@@ -447,6 +446,8 @@ func zombiecheck() error {
if !shuffleFound {
continue
}
//} else {
// log.Printf("NAME: %s", container.Image)
}
for _, name := range container.Names {
@@ -455,6 +456,8 @@ func zombiecheck() error {
continue
}
log.Printf("NAME: %s", name)
// Need to check time here too because a container can be removed the same instant as its created
currenttime := time.Now().Unix()
if container.State != "running" && currenttime-container.Created > int64(workerTimeout) {