Channels will be garbage collected when they go unreferenced.
Make the errors channel buffered to avoid lingering goroutines trying
to send on an unbuffered error channel with no reciever.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz@veritasgenetics.com>
wg := sync.WaitGroup{}
pdh := m[1]
success := make(chan *http.Response)
- errorChan := make(chan error)
+ errorChan := make(chan error, h.handler.Cluster.RequestLimits.GetMultiClusterRequestConcurrency())
// use channel as a semaphore to limit the number of concurrent
// requests at a time
sem := make(chan bool, h.handler.Cluster.RequestLimits.GetMultiClusterRequestConcurrency())
- defer close(errorChan)
- defer close(success)
- defer close(sem)
defer cancelFunc()
for remoteID := range h.handler.Cluster.RemoteClusters {