Skip to content

Commit

Permalink
remove filterInput from worker
Browse files Browse the repository at this point in the history
  • Loading branch information
Equanox committed Jan 5, 2023
1 parent bfd31de commit 5542979
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
5 changes: 3 additions & 2 deletions bob/aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,9 @@ func (b *B) Aggregate() (aggregate *bobfile.Bobfile, err error) {
err = aggregate.BTasks.IgnoreChildTargets()
errz.Fatal(err)

// err = aggregate.BTasks.FilterInputs()
// errz.Fatal(err)
// Filter input must run before any work is done.
err = aggregate.BTasks.FilterInputs()
errz.Fatal(err)

return aggregate, nil
}
Expand Down
4 changes: 2 additions & 2 deletions bob/playbook/build_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ func (p *Playbook) build(ctx context.Context, task *bobtask.Task) (_ processed.T
// Filter inputs populates the task input member by reading and validating
// inputs with the filesystem.
start := time.Now()
err = task.FilterInputs()
errz.Fatal(err)
// err = task.FilterInputs()
// errz.Fatal(err)
pt.FilterInputTook = time.Since(start)

start = time.Now()
Expand Down
11 changes: 9 additions & 2 deletions bobtask/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"path/filepath"
"sort"
"strings"
"sync"

"github.com/benchkram/errz"

Expand Down Expand Up @@ -50,10 +51,16 @@ func (tm Map) Walk(root string, parentLevel string, fn func(taskname string, _ T
func (tm Map) FilterInputs() (err error) {
defer errz.Recover(&err)

wg := sync.WaitGroup{}
for _, task := range tm {
err = task.FilterInputs()
errz.Fatal(err)
wg.Add(1)
go func(t Task) {
err = t.FilterInputs()
errz.Fatal(err)
wg.Done()
}(task)
}
wg.Wait()

return nil
}
Expand Down

0 comments on commit 5542979

Please sign in to comment.