Draft: Pre-compute pending build args outside retry_lock transaction

What does this MR do and why?

Move expensive queries for Ci::PendingBuild.args_from_build outside the retry_lock transaction in AssignResourceFromResourceGroupService. This reduces idle-in-transaction time by pre-computing tag lookups, CI minutes checks, and plan lookups before entering the transaction.

The args are passed through the state machine event via transition.args and flow through UpdateBuildQueueService to Ci::PendingBuild.upsert_from_build!.

References

Part of https://gitlab.com/gitlab-org/gitlab/-/work_items/589484

Screenshots or screen recordings

Before After

How to set up and validate locally

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports

Loading