code: func (p *Process) waitForSync(downstream *discoverd.Instance) {
  	p.Logger.Debug("waiting for downstream sync")
  
  	stopCh := make(chan struct{})
  	doneCh := make(chan struct{})
  
  	var once sync.Once
  	p.cancelSyncWait = func() {
  		once.Do(func() { close(stopCh); <-doneCh })
  	}
  
  	go p.waitForSyncInner(downstream, stopCh, doneCh)
  }
docs: // waitForSync waits for downstream sync in goroutine