forked from ALHP/ALHP.GO
add build queue shuffling
This commit is contained in:
5
main.go
5
main.go
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/yargevad/filepathx"
|
||||
"gopkg.in/yaml.v2"
|
||||
"io"
|
||||
"math/rand"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/signal"
|
||||
@@ -578,6 +579,10 @@ func (b *BuildManager) syncWorker() {
|
||||
pkgBuilds, err := filepathx.Glob(filepath.Join(conf.Basedir.Upstream, "/**/PKGBUILD"))
|
||||
check(err)
|
||||
|
||||
// Shuffle pkgbuilds to spread out long-running builds, otherwise pkgBuilds is alphabetically-sorted
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
rand.Shuffle(len(pkgBuilds), func(i, j int) { pkgBuilds[i], pkgBuilds[j] = pkgBuilds[j], pkgBuilds[i] })
|
||||
|
||||
for _, pkgbuild := range pkgBuilds {
|
||||
if b.exit {
|
||||
return
|
||||
|
Reference in New Issue
Block a user