fixed potential out of bounds

This commit is contained in:
2022-08-13 22:03:16 +02:00
parent 8ff928d7fa
commit b48c75a177
2 changed files with 38 additions and 35 deletions

View File

@@ -329,9 +329,10 @@ func (b *BuildManager) refreshSRCINFOs(ctx context.Context, path string) error {
cur := 0
wg := sync.WaitGroup{}
for i := 0; i < runtime.NumCPU(); i++ {
if cur+step > len(pkgBuilds) {
step -= cur + step - len(pkgBuilds)
if i == runtime.NumCPU()-1 {
step = len(pkgBuilds) - cur
}
wg.Add(1)
go func(pkgBuilds []string) {
defer wg.Done()

View File

@@ -568,6 +568,7 @@ func housekeeping(repo string, march string, wg *sync.WaitGroup) error {
}
}
/*
// check queued packages for eligibility
log.Debugf("[HK/%s] check queued packages", fullRepo)
qPackages, err := db.DbPackage.Query().Where(
@@ -603,6 +604,7 @@ func housekeeping(repo string, march string, wg *sync.WaitGroup) error {
log.Warningf("[HK/%s] unable to determine status for %s: %v", fullRepo, dbPkg.Pkgbase, err)
}
}
*/
log.Debugf("[HK/%s] all tasks finished", fullRepo)
return nil