Await completion of pull round before starting next (ref #2)

This commit is contained in:
Jakob Borg 2014-01-01 08:02:12 -05:00
parent 7e0be89052
commit 5b84b72d15
1 changed files with 5 additions and 0 deletions

View File

@ -144,12 +144,15 @@ func (m *Model) puller() {
}
var limiter = make(chan bool, opts.Advanced.FilesInFlight)
var allDone sync.WaitGroup
for _, n := range ns {
limiter <- true
allDone.Add(1)
go func(n string) {
defer func() {
allDone.Done()
<-limiter
}()
@ -178,6 +181,8 @@ func (m *Model) puller() {
}
}(n)
}
allDone.Wait()
}
}