Calculate expected wait time in a Jenkins build queue given executor availability.
When more builds are queued than there are free executors, Jenkins processes them in batches roughly the size of the executor pool, so a build's expected wait time is proportional to how many 'rounds' of builds must complete ahead of it. Dividing queue length by executor count gives the number of rounds, and multiplying by average build time converts that into an estimated wall-clock wait — a simplified model that assumes builds are homogeneous and executors are fungible across them.
waitTime = (queueLength / executors) × avgBuildTime
Real queues have heterogeneous build durations, executor labels/restrictions that prevent some builds from using all executors, and priority/quiet-period settings — all of which this simplified average-based model doesn't capture.
Add more executors (more agents or higher per-agent executor count), reduce average build time itself (caching, parallelism), or use build throttling/priority plugins to ensure critical builds aren't stuck behind low-priority ones.
No — it assumes any of the available executors can run the queued builds; in practice, label-restricted builds (e.g. requiring a GPU or specific OS) effectively queue against a smaller executor pool than the cluster-wide total.