prow/plank/controller.go
func syncProwJobs(
	l *logrus.Entry,
	syncFn syncFn,
	maxSyncRoutines int,
	jobs <-chan prowapi.ProwJob,
	reports chan<- prowapi.ProwJob,
	syncErrors chan<- error,
	pm map[string]coreapi.Pod,
) {
	goroutines := maxSyncRoutines
	if goroutines > len(jobs) {
		goroutines = len(jobs)
	}
	wg := &sync.WaitGroup{}
	wg.Add(goroutines)
	l.Debugf("Firing up %d goroutines", goroutines)
	for i := 0; i < goroutines; i++ {
		go func() {
			defer wg.Done()
			for pj := range jobs {
				if err := syncFn(pj, pm, reports); err != nil {
					syncErrors <- err
				}
			}
		}()
	}
	wg.Wait()
}
func syncProwJobs(
	l *logrus.Entry,
	syncFn syncFn,
	maxSyncRoutines int,
	jobs <-chan prowapi.ProwJob,
	reports chan<- prowapi.ProwJob,
	syncErrors chan<- error,
	pm map[string]coreapi.Pod,
) {
	goroutines := maxSyncRoutines
	if goroutines > len(jobs) {
		goroutines = len(jobs)
	}
	wg := &sync.WaitGroup{}
	wg.Add(goroutines)
	l.Debugf("Firing up %d goroutines", goroutines)
	for i := 0; i < goroutines; i++ {
		go func() {
			defer wg.Done()
			for pj := range jobs {
				if err := syncFn(pj, pm, reports); err != nil {
					syncErrors <- err
				}
			}
		}()
	}
	wg.Wait()
}
func syncProwJobs ( l * logrus . Entry , syncFn syncFn , maxSyncRoutines int , jobs <- chan prowapi . ProwJob , reports chan <- prowapi . ProwJob , syncErrors chan <- error , pm map [ string ] coreapi . Pod , ) { goroutines := maxSyncRoutines if goroutines > len ( jobs ) { goroutines = len ( jobs ) } wg := & sync . WaitGroup { } wg . Add ( goroutines ) l . Debugf ( " " , goroutines ) for i := 0 ; i < goroutines ; i ++ { go func ( ) { defer wg . Done ( ) for pj := range jobs { if err := syncFn ( pj , pm , reports ) ; err != nil { syncErrors <- err } } } ( ) } wg . Wait ( ) }
// TODO: Dry this out
TODO : Dry this out