Ejemplo n.º 1
0
func (data *consulData) getServiceEntries(health *api.Health) (entries []*api.ServiceEntry, err error) {
	options := api.QueryOptions{}
	if data.dc != "" {
		options.Datacenter = data.dc
	}

	entries, _, err = health.Service(data.serviceName, data.serviceTag, true, &options)
	return entries, err
}
Ejemplo n.º 2
0
func waitForHealthy(healthCheckName string, health *api.Health, log logging.Logger) {
	for {
		checks, _, err := health.State("passing", nil)
		if err != nil {
			log.Panic("Unable to read health check status", err)
		}

		for _, check := range checks {
			if check.Name == healthCheckName {
				return
			}
		}

		time.Sleep(250 * time.Millisecond)
	}
}