Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Commit

Permalink
tweak health check (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
umairidris authored Mar 2, 2020
1 parent 5898a3a commit e3a6548
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cdap/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ func chain(fs ...schema.CreateFunc) schema.CreateFunc {
})
}

var retryErrCodes = map[int]bool{502: true, 504: true}
var retryErrCodes = map[int]bool{400: true, 502: true, 504: true}

// TODO(umairidris): Remove this once CDF create call returns only after all services are running.
func checkHealth(_ *schema.ResourceData, m interface{}) error {
config := m.(*Config)
for i := 0; i < 50; i++ {
log.Printf("checking system artifact attempt %d", i)
time.Sleep(10 * time.Second)
exists, err := artifactExists(config, "cdap-data-pipeline", "default")
var e *httpError
switch {
Expand All @@ -54,7 +55,6 @@ func checkHealth(_ *schema.ResourceData, m interface{}) error {
default: // !exists
log.Println("system artifact not yet loaded, retrying after 10 seconds")
}
time.Sleep(10 * time.Second)
}
return errors.New("system artifact failed to come up in 50 tries")
}

0 comments on commit e3a6548

Please sign in to comment.