mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
Await completion of pull round before starting next (ref #2)
This commit is contained in:
parent
7e0be89052
commit
5b84b72d15
@ -144,12 +144,15 @@ func (m *Model) puller() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var limiter = make(chan bool, opts.Advanced.FilesInFlight)
|
var limiter = make(chan bool, opts.Advanced.FilesInFlight)
|
||||||
|
var allDone sync.WaitGroup
|
||||||
|
|
||||||
for _, n := range ns {
|
for _, n := range ns {
|
||||||
limiter <- true
|
limiter <- true
|
||||||
|
allDone.Add(1)
|
||||||
|
|
||||||
go func(n string) {
|
go func(n string) {
|
||||||
defer func() {
|
defer func() {
|
||||||
|
allDone.Done()
|
||||||
<-limiter
|
<-limiter
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -178,6 +181,8 @@ func (m *Model) puller() {
|
|||||||
}
|
}
|
||||||
}(n)
|
}(n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
allDone.Wait()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user