Browse Source

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

Jakob Borg 12 years ago
parent
commit
5b84b72d15
1 changed files with 5 additions and 0 deletions
  1. 5 0
      model_puller.go

+ 5 - 0
model_puller.go

@@ -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()
 	}
 }