Skip to content

Commit 8f50e70

Browse files
author
Matthew Fisher
committed
Merge pull request #4233 from bacongobbler/fixup-publisher-errors
fix(publisher): ignore healthcheck values if unset
2 parents 381e7ca + 1ae9b66 commit 8f50e70

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

publisher/server/publisher.go

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ func (s *Server) publishContainer(container *docker.APIContainers, ttl time.Dura
111111
appPath := fmt.Sprintf("%s/%s", appName, containerName)
112112
keyPath := fmt.Sprintf("/deis/services/%s", appPath)
113113
for _, p := range container.Ports {
114+
var delay int
115+
var timeout int
116+
var err error
114117
// lowest port wins (docker sorts the ports)
115118
// TODO (bacongobbler): support multiple exposed ports
116119
port := strconv.Itoa(int(p.PublicPort))
@@ -119,14 +122,24 @@ func (s *Server) publishContainer(container *docker.APIContainers, ttl time.Dura
119122
configKey := fmt.Sprintf("/deis/config/%s/", appName)
120123
// check if the user specified a healthcheck URL
121124
healthcheckURL := s.getEtcd(configKey + "healthcheck_url")
122-
delay, err := strconv.Atoi(s.getEtcd(configKey + "healthcheck_initial_delay"))
123-
if err != nil {
124-
log.Println(err)
125+
initialDelay := s.getEtcd(configKey + "healthcheck_initial_delay")
126+
if initialDelay != "" {
127+
delay, err = strconv.Atoi(initialDelay)
128+
if err != nil {
129+
log.Println(err)
130+
delay = 0
131+
}
132+
} else {
125133
delay = 0
126134
}
127-
timeout, err := strconv.Atoi(s.getEtcd(configKey + "healthcheck_timeout"))
128-
if err != nil {
129-
log.Println(err)
135+
healthcheckTimeout := s.getEtcd(configKey + "healthcheck_timeout")
136+
if healthcheckTimeout != "" {
137+
timeout, err = strconv.Atoi(healthcheckTimeout)
138+
if err != nil {
139+
log.Println(err)
140+
timeout = 1
141+
}
142+
} else {
130143
timeout = 1
131144
}
132145
if healthcheckURL != "" {

0 commit comments

Comments
 (0)