Move information about CI minutes available to `ci_pending_builds`
Description
The big queuing SQL query looks for information about the amount of available CI minutes for a given context to decide if a build can be picked by shared runners.
We can denormalize this information and store in ci_pending_builds
to accelerate the big query.
Proposal
Check if CI minutes are over the quota and store this information in ci_pending_builds.minutes_exceeded
. Drop a build after an hour if there are no specific runners that can process such build (this is already done by StuckCiJobsWorker
).
Recalculate minutes_exceeded
for pending builds when someone purchases minutes.
Implementation Plan
- Introduce new columns to
ci_pending_builds
:
-
:minutes_exceeded, :boolean, null: false, default: false
-
:namespace_id, :bigint, null: false
- Create new service to update
Ci:Quota & minutes_exceeded
-
with current codepath & 2 -
with future codepath -
Follow up and kick off new service to refresh ci minutes cache in Ci::Minutes::AdditionaPacks::ChangeNamespaceService
-
Verify we drop a build after an hour if there are no specific runners that can process it
Edited by Max Orefice