TransferQueue's Wait() needs to wait until all errors have been collected
This commit is contained in:
parent
9cbf64ebda
commit
512bad14cc
@ -34,6 +34,7 @@ type TransferQueue struct {
|
||||
transferc chan Transferable // Channel for processing transfers
|
||||
errorc chan error // Channel for processing errors
|
||||
watchers []chan string
|
||||
errorwait sync.WaitGroup
|
||||
wait sync.WaitGroup
|
||||
}
|
||||
|
||||
@ -48,6 +49,8 @@ func newTransferQueue(files int, size int64, dryRun bool) *TransferQueue {
|
||||
transferables: make(map[string]Transferable),
|
||||
}
|
||||
|
||||
q.errorwait.Add(1)
|
||||
|
||||
q.run()
|
||||
|
||||
return q
|
||||
@ -82,6 +85,7 @@ func (q *TransferQueue) Wait() {
|
||||
}
|
||||
|
||||
q.meter.Finish()
|
||||
q.errorwait.Wait()
|
||||
}
|
||||
|
||||
// Watch returns a channel where the queue will write the OID of each transfer
|
||||
@ -216,6 +220,7 @@ func (q *TransferQueue) errorCollector() {
|
||||
for err := range q.errorc {
|
||||
q.errors = append(q.errors, err)
|
||||
}
|
||||
q.errorwait.Done()
|
||||
}
|
||||
|
||||
func (q *TransferQueue) transferWorker() {
|
||||
|
Loading…
Reference in New Issue
Block a user