vole
Clone
Read only, no credentials:
https://rodent.software/git/vole.git
Write over SSH with a registered key:
git clone ssh://git@0.0.0.0:2222/vole.git
A free and open-source forge that lives in your Git repo.
Phase 4: one repository may be bounded, and a freed slot wakes the parked
8d33608319bb83725256d02196925309fe521cda · Keenan Nemetz · 16d ago · parent 379dad1e
Phase 4: one repository may be bounded, and a freed slot wakes the parked max_jobs_per_repo caps how many of one repository's jobs run at once; unset there is still no cap. Ordering and bounding answer different questions: the lease already serves the least busy repository first, which stops a burst taking the whole fleet, but ordering is not a bound — and what an operator wants when one repository's build saturates the instance is a number. A repository at its cap is skipped rather than blocking, so the other repositories an account may run are still served. That makes nil from the lease mean two things: "nothing to do", and "work exists, but not for you yet". The second meaning is why Finish now wakes the parked lease — releasing a slot is work somebody can pick up, and without it a runner parked on a cap would sit out its whole wait against a queue it could already have taken. Both are one line of the same query: `? = 0 OR COALESCE(busy.n, 0) < ?`, so "no cap" does not become a second query string that can drift. The runners page renders `4 of 4 (at the cap)` beside the depth, because a queue that is full and not draining is exactly the question that page exists to answer: "7 waiting, 4 running" is a mystery where the cap is not shown. Measured: TestPerRepoCapBoundsOneRepositoryAndResumesWhenASlotFrees puts two jobs in each of two repositories with a cap of 1, so "nothing to lease" cannot be confused with "no work" — both repositories served once, a third runner refused, a finish waking the parked lease and the freed slot's own repository becoming leasable. TestRunnersPageSaysWhenARepositoryIsAtItsCap and TestMaxJobsPerRepoLoads cover the page and the key.
internal/sshserver/runner.go +2−2
| @@ -166,7 +166,7 @@ func (s *Server) serveRunner(ch ssh.Channel, user, accountID string) { | |||
| 166 | 166 | // wait closes a channel somebody is holding. Asking first and waiting second | |
| 167 | 167 | // loses exactly that race. | |
| 168 | 168 | wake := cfg.Runs.Work() | |
| 169 | run, err := cfg.Runs.Lease(owner, repos, cfg.Lease, now) | ||
| 169 | run, err := cfg.Runs.Lease(owner, repos, cfg.Lease, cfg.MaxJobsPerRepo, now) | ||
| 170 | 170 | if err != nil { | |
| 171 | 171 | _ = enc.Encode(runnerReply{Op: "lease", Error: err.Error()}) | |
| 172 | 172 | continue | |
| @@ -182,7 +182,7 @@ func (s *Server) serveRunner(ch ssh.Channel, user, accountID string) { | |||
| 182 | 182 | } | |
| 183 | 183 | // Ask again rather than assume: the wake-up may belong to a job another | |
| 184 | 184 | // runner took first, and a lease is the only thing that hands work out. | |
| 185 | run, err = cfg.Runs.Lease(owner, repos, cfg.Lease, time.Now().UTC()) | ||
| 185 | run, err = cfg.Runs.Lease(owner, repos, cfg.Lease, cfg.MaxJobsPerRepo, time.Now().UTC()) | ||
| 186 | 186 | if err != nil { | |
| 187 | 187 | _ = enc.Encode(runnerReply{Op: "lease", Error: err.Error()}) | |
| 188 | 188 | continue | |