func()

in schedule/schedule.go [36:68]


func (s *Schedule) Populate(d deploy.Deployment, getter chaosmonkey.AppConfigGetter, chaosConfig *config.Monkey, apps []string) error {
	c := make(chan *deploy.App)

	// If the caller explicitly a set of apps, use those
	// If they did not, do all apps
	if len(apps) == 0 {
		var err error
		apps, err = d.AppNames()
		if err != nil {
			return fmt.Errorf("could not retrieve list of apps: %v", err)
		}
	}

	go d.Apps(c, apps)
	i := 0 // number of apps already processed
	for app := range c {
		if i >= chaosConfig.MaxApps() {
			break
		}

		i++

		cfg, err := getter.Get(app.Name())

		if err != nil {
			log.Printf("WARNING: Could not retrieve config for app=%s. %s", app.Name(), err)
			continue
		}
		doScheduleApp(s, app, *cfg, chaosConfig)
	}

	return nil
}