Only use an open handle during the traversal section, not while waiting for subdirs

main
Mari 3 years ago
parent 164d33c27f
commit f3a9ccc8a1
  1. 4
      drive-demuxer.go

@ -274,6 +274,7 @@ func (s *Step) AreFilesIdentical(child string) bool {
func (s *Step) Walk() {
wg := sync.WaitGroup{}
s.OpenHandles <- 1
children := s.ListChildren()
s.Bar.AddTotal(int64(len(children)))
for _, child := range children {
@ -328,10 +329,8 @@ func (s *Step) Walk() {
wg.Add(1)
go func() {
defer func() {
<-s.OpenHandles
wg.Done()
}()
s.OpenHandles <- 1
substep.Walk()
s.RemoveInputDirs(child)
s.Bar.Increment()
@ -345,6 +344,7 @@ func (s *Step) Walk() {
}
}
<-s.OpenHandles
wg.Wait()
}

Loading…
Cancel
Save