~emersion/hottub

c7d8441b6363ccf6c281e79a3a3cc7aa74ed46cb — Simon Ser a month ago 19d1577 master
Limit number of jobs per check suite
1 files changed, 12 insertions(+), 2 deletions(-)

M main.go
M main.go => main.go +12 -2
@@ 6,6 6,7 @@ import (
	"fmt"
	"html/template"
	"log"
	"math/rand"
	"net/http"
	"net/url"
	"os"


@@ 26,8 27,9 @@ import (
)

const (
	monitorJobInterval = 5 * time.Second
	srhtGrants         = "builds.sr.ht/PROFILE:RO builds.sr.ht/JOBS:RW"
	monitorJobInterval   = 5 * time.Second
	srhtGrants           = "builds.sr.ht/PROFILE:RO builds.sr.ht/JOBS:RW"
	maxJobsPerCheckSuite = 4
)

var (


@@ 367,6 369,14 @@ func startCheckSuite(ctx *checkSuiteContext) error {
		return err
	}

	// Select a few manifests at random if there are too many
	if len(filenames) > maxJobsPerCheckSuite {
		rand.Shuffle(len(filenames), func(i, j int) {
			filenames[i], filenames[j] = filenames[j], filenames[i]
		})
		filenames = filenames[:maxJobsPerCheckSuite]
	}

	for _, filename := range filenames {
		if err := startJob(ctx, filename); err != nil {
			return err