forked from ALHP/ALHP.GO
fixed potential out of bounds
This commit is contained in:
5
main.go
5
main.go
@@ -329,9 +329,10 @@ func (b *BuildManager) refreshSRCINFOs(ctx context.Context, path string) error {
|
|||||||
cur := 0
|
cur := 0
|
||||||
wg := sync.WaitGroup{}
|
wg := sync.WaitGroup{}
|
||||||
for i := 0; i < runtime.NumCPU(); i++ {
|
for i := 0; i < runtime.NumCPU(); i++ {
|
||||||
if cur+step > len(pkgBuilds) {
|
if i == runtime.NumCPU()-1 {
|
||||||
step -= cur + step - len(pkgBuilds)
|
step = len(pkgBuilds) - cur
|
||||||
}
|
}
|
||||||
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func(pkgBuilds []string) {
|
go func(pkgBuilds []string) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
2
utils.go
2
utils.go
@@ -568,6 +568,7 @@ func housekeeping(repo string, march string, wg *sync.WaitGroup) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// check queued packages for eligibility
|
// check queued packages for eligibility
|
||||||
log.Debugf("[HK/%s] check queued packages", fullRepo)
|
log.Debugf("[HK/%s] check queued packages", fullRepo)
|
||||||
qPackages, err := db.DbPackage.Query().Where(
|
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.Warningf("[HK/%s] unable to determine status for %s: %v", fullRepo, dbPkg.Pkgbase, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
log.Debugf("[HK/%s] all tasks finished", fullRepo)
|
log.Debugf("[HK/%s] all tasks finished", fullRepo)
|
||||||
return nil
|
return nil
|
||||||
|
Reference in New Issue
Block a user