Make container exist errors non-retriable

This change makes it so that the task runner does not retry container
exists errors and also a sleep is added on the local retry.
This commit is contained in:
Alex Dadgar
2016-11-25 19:22:58 -08:00
parent 3e6390839f
commit 49ee34c1e3
4 changed files with 20 additions and 2 deletions

View File

@@ -949,8 +949,7 @@ func (d *DockerDriver) createContainer(config docker.CreateContainerOptions) (*d
recoverable := func(err error) *structs.RecoverableError {
r := false
if strings.Contains(err.Error(), "Client.Timeout exceeded while awaiting headers") ||
strings.Contains(err.Error(), "EOF") ||
strings.Contains(err.Error(), "container already exists") {
strings.Contains(err.Error(), "EOF") {
r = true
}
return structs.NewRecoverableError(err, r)
@@ -997,6 +996,7 @@ CREATE:
if attempted < 5 {
attempted++
time.Sleep(1 * time.Second)
goto CREATE
}
}

View File

@@ -29,3 +29,9 @@ client {
ports {
http = 5656
}
advertise {
http = "localhost"
rpc = "localhost"
serf = "localhost"
}

View File

@@ -23,3 +23,9 @@ client {
ports {
http = 5657
}
advertise {
http = "localhost"
rpc = "localhost"
serf = "localhost"
}

View File

@@ -11,3 +11,9 @@ server {
# Self-elect, should be 3 or 5 for production
bootstrap_expect = 1
}
advertise {
http = "localhost"
rpc = "localhost"
serf = "localhost"
}