Skip to content

Commit

Permalink
fix(hatchery/swarm): don't rm too young networks (#3164)
Browse files Browse the repository at this point in the history
  • Loading branch information
yesnault authored and fsamin committed Aug 8, 2018
1 parent e82c9ac commit 0e7619b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions engine/hatchery/swarm/swarm_util_kill.go
Expand Up @@ -3,6 +3,7 @@ package swarm
import (
"strconv"
"strings"
"time"

types "github.com/docker/docker/api/types"
context "golang.org/x/net/context"
Expand Down Expand Up @@ -126,6 +127,11 @@ func (h *HatcherySwarm) killAwolNetworks() error {
continue
}

// if network created less than 10 min, keep it alive for now
if time.Since(nets[i].Created) < 10*time.Minute {
continue
}

log.Debug("hatchery> swarm> killAwolNetworks> Delete network %s from %s", n.Name, dockerClient.name)
if err := dockerClient.NetworkRemove(context.Background(), n.ID); err != nil {
log.Warning("hatchery> swarm> killAwolNetworks> Unable to delete network %s err:%s", n.Name, err)
Expand Down

0 comments on commit 0e7619b

Please sign in to comment.