diff options
Diffstat (limited to 'rill.go')
| -rw-r--r-- | rill.go | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -150,13 +150,19 @@ func (f *Forge) RillFuncError(rillf func(*gitpb.Repo) error) int { return counter } +func (f *Forge) ConfigRill(rillX int, rillY int) { +} + // x is the size of the queued up pool (shouldn't matter here for this I think) // y is how many simultanous functions will run // todo: tune and compute x,y by # of CPUs and disk io // todo: store x,y in forge config ? (or compute them. notsure) -func (f *Forge) RillRepo(rillX int, rillY int, rillf func(*gitpb.Repo) error) (int, error) { - var anyerr error +func (f *Forge) RillRepos(rillf func(*gitpb.Repo) error) map[*gitpb.Repo]error { var all []*gitpb.Repo + + var allerr map[*gitpb.Repo]error + allerr = make(map[*gitpb.Repo]error) + for repo := range f.Repos.IterAll() { if !repo.IsValidDir() { log.Printf("%s %-50s", "got an invalid repo in forgepb.RillFuncError()", repo.GetGoPath()) @@ -173,11 +179,11 @@ func (f *Forge) RillRepo(rillX int, rillY int, rillf func(*gitpb.Repo) error) (i // Read users from the API. // Concurrency = 20 - dirs := rill.Map(ids, rillX, func(id *gitpb.Repo) (*gitpb.Repo, error) { + dirs := rill.Map(ids, f.rillX, func(id *gitpb.Repo) (*gitpb.Repo, error) { return id, nil }) - rill.ForEach(dirs, rillY, func(repo *gitpb.Repo) error { + rill.ForEach(dirs, f.rillY, func(repo *gitpb.Repo) error { meMu.Lock() counter += 1 if counter > watch { @@ -186,10 +192,12 @@ func (f *Forge) RillRepo(rillX int, rillY int, rillf func(*gitpb.Repo) error) (i } meMu.Unlock() if err := rillf(repo); err != nil { - anyerr = err + meMu.Lock() + allerr[repo] = err + meMu.Unlock() } return nil }) - return counter, anyerr + return allerr } |
