summaryrefslogtreecommitdiff
path: root/rill.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-07-21 22:25:15 -0500
committerJeff Carr <[email protected]>2025-07-21 22:25:15 -0500
commit8e8d9e9a692e78c0a4b014fab048a2ee86caf855 (patch)
tree38811d53125120aac63103da377b68c5175f6547 /rill.go
parentb6a7af773d3216346d08d23b3d960d5c01048d9b (diff)
return a map of the repos & errors
Diffstat (limited to 'rill.go')
-rw-r--r--rill.go20
1 files changed, 14 insertions, 6 deletions
diff --git a/rill.go b/rill.go
index cc77d71..2c02149 100644
--- a/rill.go
+++ b/rill.go
@@ -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
}