rill in forge.Config

This commit is contained in:
Jeff Carr 2025-09-13 07:09:40 -05:00
parent 27a539b879
commit 2b3bd66ef2
4 changed files with 8 additions and 20 deletions

View File

@ -171,7 +171,7 @@ func (f *Forge) VerifyBranchNames(repo *gitpb.Repo) {
repo.SetUserBranchName(uname) repo.SetUserBranchName(uname)
} }
} }
log.Info("VerifyBranchNames", repo.GetMasterBranchName(), repo.GetDevelBranchName(), repo.GetUserBranchName()) // log.Info("VerifyBranchNames", repo.GetMasterBranchName(), repo.GetDevelBranchName(), repo.GetUserBranchName())
} }
// what name should be used for the user branch? // what name should be used for the user branch?

11
rill.go
View File

@ -115,9 +115,9 @@ func (f *Forge) RillFuncError(rillf func(*gitpb.Repo) error) map[string]*RillSta
} }
func (f *Forge) ConfigRill(rillX int, rillY int) { func (f *Forge) ConfigRill(rillX int, rillY int) {
f.rillX = rillX f.Config.RillX = int32(rillX)
f.rillY = rillY f.Config.RillY = int32(rillY)
log.Infof("Setting rill values to %d,%d\n", f.rillX, f.rillY) log.Infof("Setting rill values to %d,%d\n", f.Config.RillX, f.Config.RillY)
} }
type RillStats struct { type RillStats struct {
@ -148,6 +148,7 @@ func (f *Forge) RillRepos(rillf func(*gitpb.Repo) error) map[string]*RillStats {
} }
all = append(all, repo) all = append(all, repo)
} }
// log.Info("Rill Repos len =", len(all))
// Convert a slice of user IDs into a channel // Convert a slice of user IDs into a channel
ids := rill.FromSlice(all, nil) ids := rill.FromSlice(all, nil)
@ -156,11 +157,11 @@ func (f *Forge) RillRepos(rillf func(*gitpb.Repo) error) map[string]*RillStats {
// Read users from the API. // Read users from the API.
// Concurrency = 20 // Concurrency = 20
dirs := rill.Map(ids, f.rillX, func(id *gitpb.Repo) (*gitpb.Repo, error) { dirs := rill.Map(ids, int(f.Config.RillX), func(id *gitpb.Repo) (*gitpb.Repo, error) {
return id, nil return id, nil
}) })
rill.ForEach(dirs, f.rillY, func(repo *gitpb.Repo) error { rill.ForEach(dirs, int(f.Config.RillY), func(repo *gitpb.Repo) error {
// todo: make this a goroutine to show stats to the user // todo: make this a goroutine to show stats to the user
rillMu.Lock() rillMu.Lock()
counter += 1 counter += 1

View File

@ -1,8 +1,6 @@
package forgepb package forgepb
import ( import (
"os"
"github.com/destel/rill" "github.com/destel/rill"
"go.wit.com/lib/config" "go.wit.com/lib/config"
"go.wit.com/lib/protobuf/gitpb" "go.wit.com/lib/protobuf/gitpb"
@ -55,17 +53,12 @@ func (f *Forge) checkNamespace(fullpath string) (*gitpb.Repo, error) {
} }
func (f *Forge) ScanRepoDir() error { func (f *Forge) ScanRepoDir() error {
if r := recover(); r != nil {
log.Warn("panic ecovered in", r)
// debug.PrintStack()
// pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
panic(os.Stdout)
}
dirs, err := gitDirectoriesNew(f.Config.ReposDir) dirs, err := gitDirectoriesNew(f.Config.ReposDir)
if err != nil { if err != nil {
return err return err
} }
log.Info("doing reload()")
stats := f.RillRepos(reloadCheck) stats := f.RillRepos(reloadCheck)
for _, stat := range stats { for _, stat := range stats {
if stat.Err == nil { if stat.Err == nil {

View File

@ -14,13 +14,7 @@ type Forge struct {
Repos *gitpb.Repos // the repo protobufs Repos *gitpb.Repos // the repo protobufs
Patchsets *Patchsets // patches that are in progress Patchsets *Patchsets // patches that are in progress
hostname string // your hostname hostname string // your hostname
rillX int // used for Rill()
rillY int // used for Rill()
goWork bool // means the user is currently using a go.work file goWork bool // means the user is currently using a go.work file
// goSrc string // the path to go/src
// forgeURL string // URL to use to forge.wit.com
// configDir string // normally ~/.config/forge
// patchDir string // where patches are stored
} }
func (f *Forge) IsGoWork() bool { func (f *Forge) IsGoWork() bool {