might show branch age in table finally

This commit is contained in:
Jeff Carr 2025-01-19 10:48:50 -06:00
parent f29f25b9b7
commit 58c64cd53b
2 changed files with 13 additions and 2 deletions

View File

@ -179,7 +179,7 @@ func (f *Forge) printRepoToTable(repo *gitpb.Repo) {
// ctime := repo.Tags.GetAge(mhort) // ctime := repo.Tags.GetAge(mhort)
// age := shell.FormatDuration(time.Since(ctime)) // age := shell.FormatDuration(time.Since(ctime))
age := shell.FormatDuration(repo.NewestAge()) age := shell.FormatDuration(repo.BranchAge(cname))
if repo.IsDirty() { if repo.IsDirty() {
age = "" age = ""

13
rill.go
View File

@ -1,6 +1,8 @@
package forgepb package forgepb
import ( import (
"sync"
"github.com/destel/rill" "github.com/destel/rill"
"go.wit.com/lib/protobuf/gitpb" "go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log" "go.wit.com/log"
@ -65,7 +67,7 @@ func (f *Forge) updateRepo(repo *gitpb.Repo) error {
return nil return nil
} }
var RillX int = 30 var RillX int = 10
var RillY int = 10 var RillY int = 10
// x is the size of the queued up pool (shouldn't matter here for this I think) // x is the size of the queued up pool (shouldn't matter here for this I think)
@ -125,6 +127,9 @@ func (f *Forge) RillFuncError(rillf func(*gitpb.Repo) error) int {
ids := rill.FromSlice(all, nil) ids := rill.FromSlice(all, nil)
var counter int var counter int
var watch int = 10
var meMu sync.Mutex
// Read users from the API. // Read users from the API.
// Concurrency = 20 // Concurrency = 20
dirs := rill.Map(ids, RillX, func(id *gitpb.Repo) (*gitpb.Repo, error) { dirs := rill.Map(ids, RillX, func(id *gitpb.Repo) (*gitpb.Repo, error) {
@ -132,7 +137,13 @@ func (f *Forge) RillFuncError(rillf func(*gitpb.Repo) error) int {
}) })
err := rill.ForEach(dirs, RillY, func(repo *gitpb.Repo) error { err := rill.ForEach(dirs, RillY, func(repo *gitpb.Repo) error {
meMu.Lock()
counter += 1 counter += 1
if counter > watch {
// log.Info("Processed", watch, "repos") // this doesn't work
watch += 50
}
meMu.Unlock()
return rillf(repo) return rillf(repo)
}) })